Link to home
Start Free TrialLog in
Avatar of Pau Lo
Pau Lo

asked on

python 2.7 full path

I have python 2.7 installed on a windows 7 machine (very new to python), when it comes to running scripts I cannot just enter python myscript.py or py myscript.py, I have to enter the full path to the exe i.e. c:\python27\python.exe myscript.py

is there anyway to configure python to remember the path so i can run scripts with just python or py from the command prompt?
ASKER CERTIFIED SOLUTION
Avatar of Dan Craciun
Dan Craciun
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As far as I understand
py.exe is a new feature of python 3.
it's basically a python launcher, which parses the first line ( e.g. #!/usr/bin/env python3 ) and calls then the according python with a compatible version.

py.exe is located in C:\Windows\py.exe if you installed a python 3.x version
Avatar of techtonik
techtonik

I can't find py.exe inside of 2.7.6 installer. Looks like PEP-397 Abstract paragraph should be updated with information how the launcher is shipped. http://legacy.python.org/dev/peps/pep-0397/
py.exe is part of a python 3 install and will be copied to C:\Windows\py.exe
This is the python launcher. as discussed in the PEP document mentioned by techtonic.

If you don't install python 3 but only python 2 you will not find py.exe

If you install python 2 and python 3, then the launcher be associated with the .py and the .pyw file suffixes and depending on the first line (shebang line) call the apropriate python executable
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial