Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and uninstall python virtual environment

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report