1、 下载并安装Miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
这一步其实也可以不要,conda是管理虚拟环境的,为了防止以后多个环境有冲突,建议安装。
接受两个仓库的服务条款:
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
2、创建 yolov5 环境
conda create -n yolov5 python=3.8 -y
激活yolov5环境
conda activate yolov5
3、下载torch
下载torch时进入torch官网,选择合适的版本,我选的cpu,如果有GPU可以选择GPU,和window搭建一致。
最后的 -i 网址是指定阿里云镜像,我试了试清华镜像和阿里云,在我这阿里云下载更快,不过不指定是直接从官网下载。
pip install torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1 -i https://mirrors.aliyun.com/pypi/simple

4、下载其他依赖包
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
5、最终运行例子
