基于WSL2搭建OpenMMLab调试环境
WSL2安装
https://learn.microsoft.com/zh-cn/windows/wsl/install-manual#step-4—download-the-linux-kernel-update-package
WSL2安装完毕后,打开windows store(关闭VPN),搜索Ubuntu18.04并进行安装
需要注意的是:由于cuda对ubuntu的版本有要求,所以一般安装18.04或者20.04
安装vs code
https://learn.microsoft.com/zh-cn/windows/wsl/tutorials/wsl-vscode
vscode安装调试python所需的相应拓展:
Python
Python Extension Pack
wsl2与windows代理设置
https://zhuanlan.zhihu.com/p/153124468
wsl2安装conda
https://www.anaconda.com/products/distribution#Downloads
安装完conda后需要重启WSL2
pip挂载清华源
https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
安装cuda 11.3
https://developer.nvidia.com/cuda-11.3.0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_local
注意Distribution中选择,WSL-Ubuntu
wget https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh
chmod 777 Anaconda3-2022.10-Linux-x86_64.sh
bash Anaconda3-2022.10-Linux-x86_64.sh
vim ~/.bashrc
# 在最后一行添加export PATH="/usr/local/cuda/bin:$PATH"
source ~/.bashrc
配置OpenMMLab的Conda虚拟环境
安装pytorch
https://pytorch.org/get-started/previous-versions/
建议安装1.11版本
git clone以下源码:
mmyolo
mmdetection 3.x
mmengine
mmcv 2.x
mmcv需要根据环境完成编译:https://mmcv.readthedocs.io/en/latest/get_started/build.html
为方便查看源码,完成软连接:
cd mmyolo
ln -s …/mmengine/mmengine/ mmengine
ln -s …/mmdetection/mmdet mmdet
ln -s …/mmcv/mmcv/ mmcv\
根据官网教程进行安装其余库(不要安装软连接的库):
https://mmyolo.readthedocs.io/zh_CN/latest/get_started.html