admin管理员组文章数量:1622993
1. 安装在C盘的方法
以下教程安装在C盘
(254条消息) Win10下安装配置使用WSL2_RenLJ1895的博客-CSDN博客_win10 安装wsl2
2. 安装在非C盘的方法
(254条消息) win10安装子系统(wsl)到非C盘,其它盘的方法_Locutus的博客-CSDN博客_win10子系统安装到其他盘
(254条消息) WSL1升级至WSL2_goldVitaminC的博客-CSDN博客_wsl1升级到wsl2
2.1 我的安装过程:
打开子系统选项和虚拟机:
# 子系统
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all
/norestart
# 虚拟机
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
修改win配置:
打开控制面版,查看方式选择大图标,再点击程序与功能—>启用或关闭Windows功能,检查下图中红框圈出内容是否均以打对勾;若没有,则需要打对勾并点击确定
重启,更新配置
链接:https://pan.baidu/s/14MVfl9g1iCJoSxPp_9susQ
提取码:18ei
下载好如下文件:
powershell管理员方式运行:
./ubuntu2004.exe
运行完成,查看版本号:
wsl -l -v
# 结果
NAME STATE VERSION
* Ubuntu-20.04 Stopped 1
下载版本更新包,并运行:
https://wslstorestorage.blob.core.windows/wslblob/wsl_update_x64.msi
更新版本设置:
wsl --set-version Ubuntu-20.04 2
wsl -l -v
# 结果
NAME STATE VERSION
* Ubuntu-20.04 Stopped 2
使用一:下载mobaxterm,他自动适配wsl子系统
使用二:vscode
下载扩展 remote ssh,打开 wsl targets即可启动ubuntu系统
使用三:命令行启动
# 运行:
wsl --distribution Ubuntu-20.04
#或者
wsl -d Ubuntu-20.04
# 查看
wsl -l --running
Windows Subsystem for Linux Distributions:
Ubuntu-20.04 (Default)
# 停止
wsl -t Ubuntu-20.04
# 或者
wsl --terminate Ubuntu-20.04
更新源:
# 备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 打开
sudo vim /etc/apt/sources.list
# 将源文件内容全部注释,并添加以下任意源
# 阿里源
deb http://mirrors.aliyun/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun/ubuntu/ focal-backports main restricted universe multiverse
# 清华源
deb http://mirrors.tuna.tsinghua.edu/ubuntu/ focal main restricted
deb http://mirrors.tuna.tsinghua.edu/ubuntu/ focal-updates main restricted
deb http://mirrors.tuna.tsinghua.edu/ubuntu/ focal universe
deb http://mirrors.tuna.tsinghua.edu/ubuntu/ focal-updates universe
deb http://mirrors.tuna.tsinghua.edu/ubuntu/ focal multiverse
deb http://mirrors.tuna.tsinghua.edu/ubuntu/ focal-updates multiverse
deb http://mirrors.tuna.tsinghua.edu/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu/ubuntu/ focal-security main restricted
deb http://mirrors.tuna.tsinghua.edu/ubuntu/ focal-security universe
deb http://mirrors.tuna.tsinghua.edu/ubuntu/ focal-security multiverse
# 保存,退出,更新源
sudo apt-get update
# 更新文件
sudo apt-get dist-upgrade
sudo apt-get upgrade
与windos文件系统的联系,该子系统已经自动挂在了win的文件系统,在/mnt下
以上参考如下教程:
(254条消息) Win10下安装配置使用WSL2_RenLJ1895的博客-CSDN博客_win10 安装wsl2
3. 配置桌面
3.1 vncviewer
(254条消息) win10用vncviewer远程登陆ubuntu桌面_vieo的博客-CSDN博客_vnc远程桌面 win10
3.1 方法二,用mobaxterm
4. 安装驱动
nvidia官方文档:CUDA on WSL :: CUDA Toolkit Documentation (nvidia)
特别说明:
不要质疑,选windows;;另外开发人员用studio、玩游戏用game版本
cuda安装:选wsl版本
CUDA Toolkit 11.6 Update 2 Downloads | NVIDIA Developer
wget https://developer.download.nvidia/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/compute/cuda/11.6.2/local_installers/cuda-repo-wsl-ubuntu-11-6-local_11.6.2-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-11-6-local_11.6.2-1_amd64.deb
sudo apt-key add /var/cuda-repo-wsl-ubuntu-11-6-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
根据以上命令安装。完成后配置bashrc文件。注意cuda版本号。
# bashrc最后添加,,source激活
export PATH=/usr/local/cuda-11.6/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64$LD_LIBRARY_PATH # 此处为cuda,写版本号理论上也行
# 检测
nvcc -V
检测nvidia-smi,报错
Failed to initialize NVML: GPU access blocked by the operating system
Failed to properly shut down NVML: GPU access blocked by the operating system
原因是,win10系统的版本号没达到版本要求。要求21H2版本之后
更新winwods:若有更新,选择21H2以后的版本,重启更新
更新后,可用
安装cudnn
(257条消息) Windows 11/10 WSL2 Ubuntu 20.04 下配置Cuda及Pytorch_Quatttschen的博客-CSDN博客
cuDNN Archive | NVIDIA Developer https://developer.nvidia/rdp/cudnn-archive
要用来写程序,不能下载deb文件。
https://developer.download.nvidia/compute/cudnn/secure/8.3.3/local_installers/11.5/cudnn-linux-x86_64-8.3.3.40_cuda11.5-archive.tar.xz?Zm1niKkbC16toa3JG2QCVgDqFWiHhBOpcRTLNrwjmLbPNuXl8BW0BM48VfVPpImihSZ_K3FacqO31HDAcgG8f2IG40kQyk4ePx1R-vQJ3G2tdbfo7Ks4BNGt8sOy-kXapPab3FMjhdjcgRXCv4xe5BgXmpEwVQHb240HRr0m_Jq3OOJw1SgSI28rUbzwA2piWQInbcx1omeVUL10bo9F9FmREg&t=eyJscyI6InJlZiIsImxzZCI6IlJFRi13d3cubnZpZGlhLmNuXC8ifQ
打赏一毛。
tar.xz解压
xz -d ...
tar -xvf ...
复制lib和include文件到上述cuda安装目录
sudo cp -P cudnn-11.5/lib/libcudnn* /usr/local/cuda-11.6/lib64/
sudo cp -P cudnn-11.5/include/* /usr/local/cuda-11.6/include/
# 查看
cat /usr/local/cuda-11.6/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
# 输出
#define CUDNN_MAJOR 8
#define CUDNN_MINOR 3
#define CUDNN_PATCHLEVEL 3
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
#endif /* CUDNN_VERSION_H */
安装python深度学习环境
# anaconda换源
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/pkgs/main/
conda config --set show_channel_urls yes
# 安装pytorch,cuda11.4,linux
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
版权声明:本文标题:win10安装wsl 2.0子系统 安装在非C盘 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1728876334a1177673.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论