Home >Backend Development >Python Tutorial >Compatibility issues between python2 and 3 on Windows platform
Many friends have installedpython2 and 3, because some libraries such as scapy, not scrapy, and python3 are all wrong, so how to use python2 and 3 Coexist.
Like ordinary programmers, achieve the following results
Compatibility issues under Windows platform
CMD can enter the interactive mode of python2 and 3 respectively
CMD can normally use the python2 and 3 versions corresponding to pip
Please follow the steps
Make sure to add the paths of python2 and 3 to the environmentVariablesC:\Python27\ ;C:\Python27\Scripts\;C:\Python36\Scripts\;C:\Python36\Scripts\
Name the python.exe in the corresponding file as python2 .exe/python3.exe, name the pip.exe in the corresponding Scripts as pip2/pip3.exe. At this timeRestart the system
Open the command line interface, Enter python2/python3 and enter successfully! ! !
The last step is to check pippip
pip2
...
It will not work if you send it first , Alas, I was tricked by Baidu
Reinstall python2/3, python3 may not be uninstalled, rapair it first and then uninstall it.
The above is the process of how I was cheated, cherish life and stay away from Baidu
The following is the correct answer
After installing python2/3, you will find that there is an additional *py.exe* program under the Windows file. This is the official correct solution.
From the command line, you can follow the following commands py -2
Enter the editing interface of python2 py -3
Similarlypy -2 -m various commands of pip
python2 runs pippy -3 -m various commands of pip
Similar to the various commandspy -2 -m one<a href="http://www.php.cn/wiki/1313.html" target="_blank">file</a>.py
Run onefile.py with python2py -3 -m onefile.py
Same thing
I suggest friends to check out Zhihu more, remember this pitfall, and alert future generations
The above is the detailed content of Compatibility issues between python2 and 3 on Windows platform. For more information, please follow other related articles on the PHP Chinese website!