1. Problem source: Python 2 PIP tool is not installed by default in CentOS. The version of Python PIP tool installed directly is 8.1.0, which is very old.
Download and install PIP for python2 using the following command
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
Note: the following command downloads and installs PIP for Python 3
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
Update PIP with the command PIP install -- upgrade PIP
Update setuptools with the command PIP install -- upgrade setuptools
2. If the PIP is linked to a python 3 pip, you can first use which PIP
to obtain the file to which the current pip is linked. For example, PIP
the possible paths are /usr/bin/PIP
or /usr/local/bin/PIP
, and then use sudo VIM/usr/bin/PIP
or sudo VIM/usr/local/bin/PIP
to modify, The documents before modification are as follows:
#!/usr/bin/python3
……
After modification, it is mainly to change python3
in the first line to python2
:
#!/usr/bin/python2
……
Then save and exit.