Python Forum

Full Version: "Python launcher" required to run *.py scripts on Windows?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As I observed v3.6.1 installs (on Windows 7) in addition to the core python engine a second program "Python Launcher".

As far as I read this component seems to be not necessary since it only aims to facilitate the handling with *.py scripts on Windows.

When I always call Python script from CommandPrompt like

D:\tools\Python\python.exe mypythonscript.py

then this Launcher should not be necessary.

Am I right?

Since I prefer to have as less prgrams installed as possible I consider to uninstall the Python Launcher.

Is this possible without causing trouble to Python executions?
(Jun-27-2017, 05:43 AM)pstein Wrote: [ -> ]When I always call Python script from CommandPrompt like

D:\tools\Python\python.exe mypythonscript.py

then this Launcher should not be necessary.
It's not necessary look at Python 3.6 and pip installation under Windows
As marked on picture you see Add Python 3.6 to Path.
Then python and pip as you see i use last in post should work from anywhere in cmd.

Part 2 also has some okay tips Python environment Windows.
I'm not a windows user.

The preferred way since 3.5 is the use of the Python launcher.
If it's installed just run py your_script.py

Since Python 3.5 you can also choose the type of installation, which is very cool.
If you install locally it as a normal User, you don't need administrator privileges.
Your installation is global, but you can still use the Python launcher.

For example: When you want to use pip, just use py -m pip install foo.
If you use the Python launcher you don't need to change the environment variables.

When you have more than one installed Python version, you can specify it with the py command.

py -2 program.py, py -2.7 program.py, py -3.5 program.py, py -3.6 program.py.
If you want to get the REPL, just use py or py -version_specifier.

You should read this document.
(Jun-27-2017, 05:43 AM)pstein Wrote: [ -> ]D:\tools\Python\python.exe mypythonscript.py

actually, in windows you don't even need that, simply:
D:\tools\Python\mypythonscript.py
will do the trick.

EDIT: I will also add, that as of Python 3.4 (I believe), Windows now honors at least a portion of the 'shebang' line (in essence, it ignores the executable location and only looks at the 'python' portion). So it's a good idea to include it in your scripts, especially if you are running multiple versions or scripting for cross platform.