无法从命令行使用Python 2

ned*_*004 0 python windows python-2.7 python-3.5 python-3.6

我最近尝试卸载Python 3.5.2并安装了Python 3.6.0。我曾经python在命令行中使用来从命令行运行Python 3.5.2,并py运行python 2.7.12。现在,python运行Python 3.5.2,然后py运行Python 3.6.0。我运行Windows 10,和python3python2py2,并py3没有做任何事情。

Mar*_*nen 5

不必在路径中添加Python。只需使用:

py            Run highest version of Python (override with PY_PTYHON environment variable).
py -2         Run highest version of Python 2.
py -3         Run highest verssion of Python 3.
py -2.7       Run Python 2.7.
py -2.7-32    Run python 2.7 32-bit when on a 64-bit system.
Run Code Online (Sandbox Code Playgroud)

更多:https : //docs.python.org/3.6/using/windows.html#python-launcher-for-windows

请注意,您还可以在脚本中指定要使用的版本,例如:

#!python2
#!python3
#!python2.7
Run Code Online (Sandbox Code Playgroud)