conda配置solov2环境
运行环境:Ubuntu 18.04
conda安装
下载
conda下载网址:https://www.anaconda.com/products/individual
根据需要选则版本下载。
我下载conda的方法如下:
- wget下载
wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
- aria2c下载
aria2c https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
推荐aria2c下载。
安装
chmod +x Anaconda3-2020.11-Linux-x86_64.sh
./Anaconda3-2020.11-Linux-x86_64.sh
# 安装过程一直yes。
启动环境
cd anaconda3/bin
chmod +x activate
. activate
# 相当于source activate
添加channels
添加清华镜像(参考网址),修改~/.condarc:
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引。
显示安装好的channels
conda config --set show_channel_urls yes
conda config --get channels
退出conda环境
. ./deactivate
## 或者用
conda deactivate
pip 设置清华源
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
配置solov2环境
# 创建虚拟环境
conda create -n solo python=3.7 -y
conda activate solo
#安装 pytorch==1.4.0 torchvision==0.5.0 试了别的1.7.0啥的都没成功
conda install pytorch==1.4.0 torchvision==0.5.0 cudatoolkit=10.1 -c pytorch
#安装opencv-python
pip install opencv-python
#安装mmcv,安装参考官方https://github.com/open-mmlab/mmcv/tree/v0.2.16
pip install mmcv-full
#安装mmdection,安装命令参考官方https://github.com/open-mmlab/mmdetection 1.0.0
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
pip install -r requirements/build.txt
pip install -v -e . # or "python setup.py develop"
#SOLO 参考https://github.com/WXinlong/SOLO/blob/master/docs/INSTALL.md
git clone https://github.com/WXinlong/SOLO.git
cd SOLO
pip install -r requirements/build.txt #solo文件中在requirements文件夹中将torch版本相关注释掉,防止重新安装,上面已经安装了1.4.0了
## 由于有墙,一直失败,后来该车为gitee仓库
pip install "git+https://gitee.com/wsyin/cocoapi.git#subdirectory=PythonAPI"
pip install -v -e . # or "python setup.py develop"
pytorch和torchvision下载:
aria2c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/torchvision-0.5.0-py37_cu101.tar.bz2
aria2c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/pytorch-1.4.0-py3.7_cuda10.1.243_cudnn7.6.3_0.tar.bz2
安装
conda install --use-local pytorch-1.4.0-py3.7_cuda10.1.243_cudnn7.6.3_0.tar.bz2
conda install --use-local torchvision-0.5.0-py37_cu101.tar.bz2