1. 安装Anaconda
wget -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2020.02-Linux-x86_64.sh
bash Anaconda3-2020.02-Linux-x86_64.sh
conda --version # conda 4.8.2
2. 使用anaconda,创建新的虚拟环境
配置国内镜像源
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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
设置搜索时显示通道地址
conda config --set show_channel_urls yes
conda create -n yolov5_env python=3.8 (conda remove -n yolov5_env --all)
conda env list
conda activate yolov5_env
3. 安装CUDA10.1
conda install cudatoolkit=10.1 -n yolov5_env -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/
conda install cudnn=7.6.5 -n yolov5_env -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/
4. 安装pytorch
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
5. 下载yolov5 code from github
git clone https://github.com/ultralytics/yolov5.git
cd yolov5
6.安装依赖库
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
7.运行测试文件
python detect.py