py.exe
get installed in Windows folder when install Python37.Can be used to accessing previous version or current,can also install with
pip
to all version installed.Example:
# Python version set in Windows Path C:\>python -V Python 3.7.0 # Can also access with py C:\>py -3.7 -V Python 3.7.0 # Older version i have C:\>py -2.7 -V Python 2.7.9 C:\>py -3.4 -V Python 3.4.2 C:\>py -3.5 -V Python 3.5.2 C:\>py -3.6 -V Python 3.6.4Use
py
to install with pip
to eg 2.7. λ py -2.7 -m pip install logzero Requirement already satisfied: logzero in c:\python27\lib\site-packagesMaking bat
hello.bat
.Use
python
main version,pause
in bat so cmd window doesn't close immediately.Can also put this last in code
input('Press Enter to exit')
.@echo off python C:/foo/hello.py %* pauseIf want to run 2.7 in a bat file,then use
py
.@echo off py -2.7 C:/foo/hello.py %* pause