The coexistence of python2 and python3

The coexistence of python2 and python3

One, manually configure environment variables

1) After downloading python2, if you don't check Add Python 3.6 to PATH, you need to set it manually.
2) Change the python.exe and pythonw.exe in the downloaded python to python2.exe and pythonw.exe
3) Add the two paths where you installed python in the system variables:
D:\Program Files\Python37\Scripts
D :\Program Files\Python37
Insert picture description here
4) Confirm and complete.

Second, use the specified python in cmd

1. Check the python2 version:
python2
Insert picture description here
2. Use python2 to download the package to the specified directory:
python2 -m pip install opencv-python
Insert picture description here3. View the package list in
python2 : python2 -m pip list
Insert picture description here4. Set the specified pip download mirror
cmd>>> Enter %appdata%>>>After opening the specified directory, create a new pip directory, create a new pip.ini file, and enter the following:
[global]
timeout = 1000 //Timeout
index-url = https://pypi.tuna.tsinghua. edu.cn/simple //(Mirror address)
[install]
trusted-host = pypi.douban.com

Guess you like

Origin blog.csdn.net/weixin_44421869/article/details/107358023