Python Forum
"Python launcher" required to run *.py scripts on Windows?
Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Python launcher" required to run *.py scripts on Windows?
#1
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?
Reply
#2
(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.
Reply
#3
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.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#4
(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.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python GDB scripts for Fedora41 voidtrance 3 689 Apr-14-2025, 05:52 PM
Last Post: voidtrance
  How to communicate between scripts in python via shared file? daiboonchu 4 1,748 Dec-31-2024, 01:56 PM
Last Post: Pedroski55
  Making a launcher application for the .exe made using Pyinstaller --onefile zazas321 9 2,539 Aug-02-2024, 03:15 AM
Last Post: deanhystad
  Coding help required in Python using VS Code KakashiSenpai 3 1,140 Jul-04-2024, 12:32 PM
Last Post: jefsummers
  Python Launcher (on Windows) only necessary when 2 or more Python versions installed? pstein 1 1,449 Feb-17-2024, 12:43 PM
Last Post: deanhystad
  Python Launcher Pops Up When Py-based App Is Running (Mac) radix_optimus 0 1,154 Sep-18-2023, 09:22 AM
Last Post: radix_optimus
  Trying to us python.exe from our network to run scripts cubangt 3 1,996 Aug-17-2023, 07:53 PM
Last Post: deanhystad
  Python Launcher INI File leodavinci1990 1 2,501 Jul-30-2023, 03:38 PM
Last Post: snippsat
  "SUMIF" type query in Python (help required) BlainEillimatta 0 1,503 Oct-06-2022, 09:08 AM
Last Post: BlainEillimatta
  python 3: TypeError: a bytes-like object is required, not 'str' wardancer84 3 9,288 Jul-09-2021, 05:55 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020