Explanation of the coexistence of multiple versions of pip in Windows

Source: Internet
Author: User

Explanation of the coexistence of multiple versions of pip in Windows

Preface

Many people may close the title directly when they see it. Is it necessary to say this simple and low question? At first glance, we know it's a little bit of Python. If you think so, there is no need to read it, because it does not help you.

This problem is indeed very simple, but it cannot be simple. But it does happen in actual work.

To be honest, people who often play on gentoo or archlinux can leave this issue alone. However, your colleagues or friends are not necessarily the same as you.

Here, we need to solve two problems:

  • Coexistence of multiple versions of pip
  • Coexistence of multiple versions of Python

Speaking of this, it may be said that using pyenv is not good, saving time and effort. However, pyenv does not support Windows.

To be honest, although you have Baidu, there are indeed N Articles that are the first to say, but when you practice it, you will find that it is not enough at all.

Coexistence of multiple versions of pip

Here, we have installed Python 2 on a Windows system with Python3.5.3 installed.

After the installation is complete, switch to the scriptsdirectory under the python2installation directory and change the pip.exefile to pip27.exe or delete it directly. Then run the following command:

pip2 -V pip 8.1.1 from C:\Python27\lib\site-packages (python 2.7)  pip -V pip 9.0.1 from C:\Python35\lib\site-packages (python 3.5) 

We can see that this solves the problem of coexistence of multiple versions of pip.

Coexistence of multiple versions of Python

Now let's take a look at the coexistence of multiple versions of Python. Many tutorials on the Internet allow us to directly modify the interpreter files of different Python versions. As a result, Python versions can coexist, But pip cannot be used.

In this case, we have two methods: one is to start different versions of Python in the following way when multiple versions of pip coexist:

py -2 py -3 

In this way, Python2 and Python3 are started respectively.

To be honest, this method is not perfect For Virgos. Next we will look at the implementation of multi-version Python coexistence under the coexistence of Multi-version pip.

.

This completes the issue of version coexistence, as shown in:


Here, because the last version installed is Python 2 and is automatically added to the environment variable, because Python2 is started when Python is input by default.

Of course, the above problems are only one of the solutions. If mathematical terms are applied, they are only one of all solutions.

For a language like Python, if there is only one method, it is often soy sauce. Generally, there are at least two or three methods for the same problem. The best method is the right one.

Summary

The above is all the content of this article. I hope the content of this article has some reference and learning value for everyone's learning or work. If you have any questions, please leave a message to us, thank you for your support.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.