On Unix-like systems:
./file.pyrequires execution file.py(e.g. chmod a+x file.py)../file.pyruns the script with any interpreter specified in its shebang line; python file.pyruns it with any interpreter with the name pythonthat is highest on yours $PATH. If you have multiple versions of Python, this can make a big difference.
, python $PATH, which python, .
, shebang python, $PATH, :
Windows:
./file.py script , *.py, python file.py python.exe, %PATH%. , Python, .
, Windows cmd.exe, Unix, shebangs, . Python, , *.py, PEP 397 Python, shebangs. ( launcher Python.)
:
,
, shebang . , Unix- , ./file.py , /bin/sh Unix Unix-, Python. , , , , , - import: command not found.