配置yolov5环境时解决Command “python setup.py egg_info“ failed with error code 1 in xxx的问题

在ubuntu18.04上配置yolov5环境时,使用命令pip3 install -U -r requirements.txt报错:
Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-ryzue9ps/opencv-python/
在这里插入图片描述
检查后发现yolov5的环境要求必须是python>=3.7、PyTorch>=1.5,而ubuntu18.04自带的python版本是
python2.7、python3.6。
依次使用命令

cd /usr/bin
ls -l | grep python

在这里插入图片描述
可以看到python3指向的是python3.6,所以要更改python3指向,使其指向python3.7。

sudo rm /usr/bin/python3
sudo ln -s python3.7 python3

在这里插入图片描述
再升级一下pip3版本

pip3 install --upgrade pip

最后pip3 install -U -r requirements.txt继续安装yolov5环境。
参考博客:
【Python】Ubuntu 18.04 安装 python3.7
ubuntu18.04安装python3.7并将python3指向python3.7

猜你喜欢

转载自blog.csdn.net/weixin_44769034/article/details/127567754
今日推荐