mmsegmentaion环境配置cuda11.0+pytorch1.7.1

参考:https://blog.csdn.net/CSDNxiaoh/article/details/125321921
官方文档:https://gitcode.net/mirrors/open-mmlab

1.创建虚拟环境

conda create -n mmdet3d python=3.7 -y
conda activate mmdet3d
Linux系统中有时会提醒没有激活activate功能,无法使用
因此,需要激活:source activate

2.安装pytorch

在官网上查看对应自己服务器的cuda版本的torch
torch官网地址:https://pytorch.org/get-started/previous-versions/

conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=11.0 -c pytorch

3.安装mmcv

查询基于自己的cuda和torch版本的mmcv,官网地址:https://gitcode.net/mirrors/open-mmlab/mmcv?utm_source=csdn_github_accelerator
mmsegmentaion环境配置cuda11.0+pytorch1.7.1_第1张图片
输入命令,注意命令中替换自己的cuda和torch版本

pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu11/torch1.7.1/index.html

踩坑:参考https://blog.csdn.net/weixin_46412818/article/details/126006081
也可以参考官网装:https://mmsegmentation.readthedocs.io/en/latest/get_started.html
无论是指定或者不指定版本,安装时都会出现Building wheel for mmcv-full (setup.py)的报错

pip install -U openmim
mim install mmcv-full
mim imstall mmcv-full == 1.5.1

最后运行代码的时候from mmseg importxxxx报错也是mmcv-full安装不成功的问题。

4.安装mmsegmentation

git clone https://github.com/open-mmlab/mmsegmentation.git
cd mmsegmentation
pip install -v -e .
# "-v" means verbose, or more output
# "-e" means installing a project in editable mode,
# thus any local modifications made to the code will take effect without reinstallation.

克隆的时候可能提醒错误:
安装git:

sudo apt install git

卸载git:

sudo apt autoremove

然后在挨个装一个requriements里面提到的其他一些包,环境就装好了。

你可能感兴趣的:(环境配置,pytorch,深度学习,python)