系统版本:Windows 10 企业版
依赖环境:Anaconda3
运行软件:PyCharm
- 通过Anaconda打开终端
2. 创建一个虚拟环境(这样不会影响其它已安装的环境)
conda create --name xxx(虚拟环境的名称) python=3.9
3. 激活虚拟环境
conda activate xxx(虚拟环境的名称)
4. 先配置下载源,只需配置一次
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
5. 安装pytorch和cuda
conda install pytorch==1.12.1 torchvision torchaudio cudatoolkit=11.3 -c conda-forge
6. 安装mmcv (!!!重要,与官网教程中的不同!)
官方指导中给的是“使用MIM 安装MMCV”,而安装这种方式安装后运行代码时往往报错。
我们采用以下方式进行安装:
根据网址IInstallation — mmcv 2.0.1 documentation生成安装命令
pip install mmcv==2.0.0rc4 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.12/index.html
7. 安装scipy等其它所需的库
pip install scipy -i https://pypi.tuna.tsinghua.edu.cn/simple/
其它操作:
更新conda至最新版 conda update -n base -c defaults conda
删除虚拟环境 conda remove --name xxx(虚拟环境的名称)