preamble
Many people may see the title of this directly off, so simple and low problem is it necessary to say it? I know it is a Python white guy. If you think so, then there is no need to read on, because there is no help for you.
This problem is indeed very simple, simple and no longer simple. But in practice, it does come up.
To be honest, for people who play a lot on gentoo, archlinux and so on, it's not a problem at all. However, your colleagues or friends may not be the same as you.
Here, we have to solve two problems.
- Multi-version pip coexistence problem
- Multi-version Python coexistence issues
Speaking of which, some people may say that it's better to use pyenv directly, which saves time and effort. However, pyenv does not support Windows.
To be honest, although you Baidu, there are really N article said the head of the road, but when you go to practice will find that simply does not work.
Multi-version pip coexistence
Here we are installing a version of Python 2 on a system that has Python 3.5.3 installed on Windows.
After the installation is complete, we switch to the Scripts directory in the Python2 installation directory, modify or delete the files therein, and then we 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)
As you can see, this solves the problem of multiple versions of pip coexisting.
Coexistence of multiple versions of Python
Here we look at the problem of multiple versions of Python coexistence. Many online tutorials allow us to modify the interpreter files of different Python versions directly, and the result is that the Python versions can coexist, but pip can not be used.
There are two ways to do this, one is to start different versions of Python when multiple versions of pip coexist as follows.
py -2 py -3
This starts Python2 and Python3 respectively.
To tell you the truth, this way is not perfect for Virgo. Here we look at a multi-version pip coexistence in the case of multi-version Python coexistence implementation.
We directly make 1 copy of the Python interpreter file from each version, and then modify it to and respectively.
This completes our version coexistence problem, as shown below.
In this case, the last version installed was Python2, and it was automatically added to the environment variable, since Python2 is started by default when typing Python.
Of course, the above problem is only one of the solutions, and if we apply the terminology of mathematics, it is only one of all the solutions.
For a language like Python, if you only know one way to do something, you'll be in trouble. In general, there are at least 2-3 ways to solve the same problem, so it is better to choose the best one.
summarize
Above is the entire content of this article, I hope that the content of this article on your learning or work has a certain reference learning value, if there are questions you can leave a message to exchange, thank you for my support.