Command "python egg_info" failed with error code 1 in /tmp/pip-build-fH0Feg/pip/

created at 08-24-2021 views: 88

error Command "python egg_info" failed with error code 1 in /tmp/pip-build-fH0Feg/pip/ when use pip to update setuptools.

1. The source of the problem: the python2 pip tool is not installed by default under centos. The version of the python-pip tool installed directly is 8.1.0, which is very old.

Use the following commands to download and install pip for python2

curl -o

Note: The following command downloads and installs pip of python3

curl -o

Use the command pip install --upgrade pip to update pip

Use the command pip install --upgrade setuptools to update setuptools

2. If the pip link is the pip of python3, you can use which pip to get the file linked to the current pip. For example, the possible path of pip is /usr/bin/pip or /usr/local/bin/pip, and then use sudo vim /usr/bin/pip or sudo vim /usr/local/bin/pip modify, the file before modification is as follows:


After the modification is as follows, the main thing is to change the python3 in the first line to python2:


Then save and exit.

created at:08-24-2021
edited at: 08-24-2021: