How to install and uninstall python virtual environment
Editor to share with you how to install and uninstall the python virtual environment, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Ubuntu16.04 installation uninstalls pip
Experimental environment
Ubuntu16.04;VMware15
Problem description
Install Ubuntu16.04 on the virtual machine, reopen it to compile the python program after a period of time, and find that when installing the required package, pip pip3 all points to python2.7.
Hadoop@ubuntu:~$ pip3.5-Vpip 19.1.1 from / usr/local/lib/python2.7/dist-packages/pip (python2.7) hadoop@ubuntu:~$ pip-Vpip 19.1.1 from / usr/local/lib/python2.7/dist-packages/pip (python2.7)
Search the Internet and search through various tutorials. You still can't let pip3 link to python3. The final solution of the problem is an accidental result after taking a long time.
Problem solving
The most frequently mentioned solutions in online tutorials are:
Install pip
Sudo apt-get install python3-pip
Upgrade pip
Sudo pip3 install-upgrade pip
Unloading
Sudo apt-get remove python3-pip
Generally speaking, this is the default that pip3 points to python3, but it doesn't solve my problem. You can try. Maybe you can solve your problem. If you can't, you can read on.
The real solution to my problem:
Install pip3
Use the following statement to install. If you want to configure pip3 for the system's native python3.5, simply execute curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6. If pip points to python3.5; after execution, we just need to execute curl https://bootstrap.pypa.io/get-pip.py again | sudo python2.7.
# check and install python3.6sudo apt-get updatesudo apt-get install python3.6curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6
Verify the pip version when you are done:
Hadoop@ubuntu:~$ pip3.5-Vpip 19.1.1 from / usr/local/lib/python3.5/dist-packages/pip (python3.5) hadoop@ubuntu:~$ pip-Vpip 19.1.1 from / usr/local/lib/python2.7/dist-packages/pip (python2.7)
It took a long time to make a note of a little problem.
In order to avoid some exceptions, it is recommended not to modify the python environment that comes with the system.
These are all the contents of the article "how to install and uninstall python Virtual Environment". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!