首先淮阐,參考:在 WSL 2 中啟用 NVIDIA CUDA - Win32 apps | Microsoft Docs 配置一些基礎(chǔ)設(shè)置。接著進(jìn)入 wsl 環(huán)境進(jìn)行配置(參考 CUDA 工具包 11.1 下載 | NVIDIA Developer):
$ wsl
$ sudo apt-get update
$ wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
$ sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
$ wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda-repo-wsl-ubuntu-11-1-local_11.1.0-1_amd64.deb
$ sudo dpkg -i cuda-repo-wsl-ubuntu-11-1-local_11.1.0-1_amd64.deb
$ sudo apt-key add /var/cuda-repo-wsl-ubuntu-11-1-local/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get -y install cuda
在安裝過(guò)程中如果報(bào)錯(cuò)“404 Not Found [IP: 180.101.196.129 443]”蜜猾,可以先嘗試離線(xiàn)安裝:
$ wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run
$ sudo sh cuda_11.1.0_455.23.05_linux.run
【可選】wsl2 安裝 GUI 參考:Install GUI Desktop in WSL2 Ubuntu 20.04 LTS in Windows 10 | by Harshit Yadav | Medium & The complete WSL2 + GUI setup. | Medium
安裝 Anaconda3
下載 Anaconda | Individual Edition辱姨,接著安裝:
$ sh Anaconda-...
配置多環(huán)境深度學(xué)習(xí)環(huán)境
- 安裝 MXNet:
$ conda create -n mxnet python=3.9
$ conda install jupyter notebook
$ conda install cudnn=8 -c conda-forge
$ pip install mxnet-cu110
$ conda install ipykernel
$ python -m ipykernel install --name mxnet --user
$ pip install autopep8
- 安裝 TensorFlow:
$ conda create -n tensorflow python=3.9
$ conda install jupyter notebook
$ conda install cudnn=8 -c conda-forge
$ pip install tensorflow
$ conda install ipykernel
$ python -m ipykernel install --name tensorflow --user
$ pip install autopep8
- 安裝 PyTorch:
$ conda create -n torch python=3.9
$ conda install jupyter notebook
$ conda install pytorch torchvision torchaudio cudatoolkit=11 -c pytorch -c conda-forge
$ conda install ipykernel
$ python -m ipykernel install --name torch --user
$ pip install autopep8