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 Launcher (on Windows) only necessary when 2 or more Python versions installed? pstein 1 308 Feb-17-2024, 12:43 PM
Last Post: deanhystad
  Python Launcher Pops Up When Py-based App Is Running (Mac) radix_optimus 0 533 Sep-18-2023, 09:22 AM
Last Post: radix_optimus
  Trying to us python.exe from our network to run scripts cubangt 3 858 Aug-17-2023, 07:53 PM
Last Post: deanhystad
  Python Launcher INI File leodavinci1990 1 807 Jul-30-2023, 03:38 PM
Last Post: snippsat
  "SUMIF" type query in Python (help required) BlainEillimatta 0 847 Oct-06-2022, 09:08 AM
Last Post: BlainEillimatta
  python 3: TypeError: a bytes-like object is required, not 'str' wardancer84 3 6,470 Jul-09-2021, 05:55 PM
Last Post: deanhystad
  Running python scripts from github etc pacmyc 7 3,691 Mar-03-2021, 10:26 PM
Last Post: pacmyc
  Reading SQL scripts from excel file and run it using python saravanatn 2 2,542 Aug-23-2020, 04:49 PM
Last Post: saravanatn
  No Scripts File present after python installation ag2207 5 4,878 Jul-30-2020, 11:11 AM
Last Post: buran
  How to merge my two python scripts in one ? HK2432 0 2,145 Jan-31-2020, 10:16 PM
Last Post: HK2432

Forum Jump:

User Panel Messages

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