Ubuntu 16.04 install and uninstall pip
The author installed ubuntu16.04 on the virtual machine. After a period of time, I reopened it to compile the python program. When installing the required package, PIP PIP3 pointed to python2.7;
[email protected]:~$ pip3.5 -V pip 19.1.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7) [email protected]:~$ pip -V pip 19.1.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
After searching the Internet and browsing through various tutorials, PIP3 still can’t link to python3. Finally, solving the problem is an accidental result of time-consuming.
The solutions mentioned most in online tutorials are:
sudo apt-get install python3-pip
sudo pip3 install --upgrade pip
sudo apt-get remove python3-pip
Generally, PIP3 points to python3 by default, but it can’t solve my problem. You can try. Maybe you can solve your problem. If not, look down.
The real solution to my problem:
Use the following statement to install. If you want to configure PIP3 for Python 3.5, just execute curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6。 If PIP points to Python 3.5 after execution, we just need to execute curl again https://bootstrap.pypa.io/get-pip.py |Sudo python2.7.
#Check and install Python 3.6 sudo apt-get update sudo apt-get install python3.6 curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6
Verify PIP version after completion:
[email protected]:~$ pip3.5 -V pip 19.1.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5) [email protected]:~$ pip -V pip 19.1.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
It took half a day to record a little bit of small problems.
To avoid some exceptions, it is recommended not to modify the python environment that comes with the system
The above is the python virtual environment installation and uninstall methods and problems that Xiaobian introduced to you. I hope it can help you!