Multiple versions of python3 and python2 coexist and solve the pip coexistence problem

Find the installation directories of python27 and python36, and modify the names of python.exe and pythonw.exe in python27 and python36 to python2.exe, pythonw2.exe, python3.exe, pythonw3.exe.

Then run the cmd command, enter python2 to run the python2 version, enter python3 to run the python3 version

  • pip2 and pip3 settings

The Python installation package needs to use the package management tool pip, but when python2 and python3 are installed at the same time, pip is only one of the versions. The following will provide a modification method, that is, reinstall the two versions of pip, so that the two versions of pip are installed. can coexist.

Enter the command in the DOS command box, and it
python3 -m pip install --upgrade pip --force-reinstall
write picture description here
shows that the pip reinstallation of python3 is successful.

List content

python2 -m pip install --upgrade pip --force-reinstall
write picture description here
Shows that the pip reinstall of python2 was successful.

Now you can view the pip information of the two versions through pip2 -V and pip3-V, and then just run pip2 install XXX and pip3 install XXX to install the respective python packages.
write picture description here

  • tips

The two programs python.exe and pythonw.exe in the python installation directory are briefly explained:

When python.exe runs the program, it will pop up a black console window (also called command line window, DOS/CMD window)

pythonw.exe is a windowless Python executable program, which means that when running the program, there is no window and the code is executed in the background.

The difference between .py and .pyw files also comes from the difference between python.exe and pythonw.exe:

When installing Python for Windows, files with a .py extension are defaulted to run with python.exe, and .pyw files are defaulted to run with pythonw.exe.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326076046&siteId=291194637