First, make sure NVIDIA driver is installed and works good, check through command nvidia-smi
.
Then install wsl —> full doc link, here I use ubuntu.
# List of distros could be installed
wsl --list --online
# Install
wsl --install -d Ubuntu-24.04
In file explorer, find the WSL file system at \\wsl$\Ubuntu\home\USERNAME
Double ckeck nvidia-smi
under WSL terminal session. Install uv and setting up tf-gpu as followed:
uv init
source .venv/bin/activate
uv add tensorflow[and-cuda]
此刻是二零二四年三月一日凌晨一点四十分,我的心情无比沉重且轻盈,我将写下这篇文档以在将来帮助自己或有需要的人。
Fuck Windows, 灾难级。
重装电脑。
主机基本配置
nvidia-smi
检查C:\Users\&Username&\
新建.wslconfig文件并粘贴以下内容以设置wsl网络mirror
experimental]<br>
autoMemoryReclaim=gradual # 开启自动回收内存,可在 gradual, dropcache, disabled 之间选择<br>
networkingMode=mirrored # 开启镜像网络<br>
dnsTunneling=true # 开启 DNS Tunneling<br>
firewall=true # 开启 Windows 防火墙<br>
autoProxy=true # 开启自动同步代理<br>
sparseVhd=true # 开启自动释放 WSL2 虚拟硬盘空间<br>
wsl --install
安装WSL(需要WSL2,较新版本的Windows会直接下载WSL2,注意检查一下)sudo passwd root
, su root
, 以root用户登陆,默认的账户一直要sudo很烦且有可能碰到指令执行报错apt install openssh-server
apt install build-essential
安装vscode参考自文档:https://dev.to/abbazs/how-to-install-vscode-in-ubuntu-using-apt-get-2m8o
Download the Microsoft GPG key: Run the following command to download the Microsoft GPG key and save it as microsoft.gpg: curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
Install the GPG key: Run the following command to install the GPG key into the trusted keyring: sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
Add the VSCode and Microsoft Edge repositories: Run the following commands to add the VSCode and Microsoft Edge repositories to the system: sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge.list' sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
Remove the downloaded GPG key: Run the following command to remove the microsoft.gpg file: sudo rm microsoft.gpg
Update package information: Run the following command to update the package information from the repositories: sudo apt update
Install VSCode: Run the following command to install Visual Studio Code: sudo apt install -y code
(Optional) Install with aptitude: If you use aptitude package manager, you can run the following commands instead of step 6 to install VSCode: sudo aptitude update sudo aptitude install -y code