When configuring the yolov5 environment on ubuntu18.04, use the command pip3 install -U -r requirements.txt to report an error:
Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-ryzue9ps/opencv-python/
After inspection, it is found that the environment requirements of yolov5 must be python>=3.7、PyTorch>=1.5
, and the python versions that come with ubuntu18.04 are
python2.7 and python3.6.
Use the commands in turn
cd /usr/bin
ls -l | grep python
You can see that python3 points to python3.6, so change the python3 point to point to python3.7.
sudo rm /usr/bin/python3
sudo ln -s python3.7 python3
Upgrade the pip3 version again
pip3 install --upgrade pip
Finally, pip3 install -U -r requirements.txt continues to install the yolov5 environment.
Reference blog:
[Python] Ubuntu 18.04 install python3.7
ubuntu18.04 install python3.7 and point python3 to python3.7