yolov5在Centos系統上部署的環境搭建
一.安裝Anaconda3
1.下載Anaconda3安裝包 :
https://repo.anaconda.com/archive/
wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh
2.執行安裝命令:
bash Anaconda3-2018.12-Linux-x86_64.sh
3.選擇安裝路徑:
Anaconda3 will now be installed into this location:/root/anaconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below
[/root/anaconda3] >>> /usr/local/anaconda3
4.選擇是否安裝VSCode,輸入no來結束安裝
Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]>>> Please answer 'yes' or 'no':>>> no
5.配置環境變量
vi /etc/profile
在尾部加下如下
export PATH=/opt/module/anaconda3/bin:$PATH
按下esc再鍵入 :wq 保存退出
最后執行如下使環境變量生效
source /etc/profile
6.驗證安裝,輸入如下命令:
conda list

略........
7.創建python3環境
conda create -n pytorch python=3.7
8.切換到python3
source activate pytorch
二.安裝pytorch的GPU版本
1.來到官網 https://pytorch.org/get-started/locally/
根據自己的環境,進行選擇,網站會給出相應的安裝命令。我這里的環境是linux、pip、cuda 11.2

pip3 install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
pip install ipython

安裝完pytorch后,我們在ipython中查看安裝的結果

說明GPU版本的pytorch安裝成功
2.YOLOv5測試
首先還是把源碼clone到本地

zip解壓:
unzip yolov5_deepsort_car.zip
3.安裝項目依賴:
(pytorch) [root@107 yolov5_deepsort_car]# pip install -r requirements.txt -i https://pypi.douban.com/simple

linux下安裝Anaconda3如果遇到找不到bzip2:

解決辦法:yum -y install bzip2
參考地址1:https://blog.csdn.net/u011435933/article/details/107045530/
參考地址3:https://xugaoxiang.com/2020/06/17/yolov5/
