Adding Python to the path in Windows

kyle at thenortheastgroup.com kyle at thenortheastgroup.com
Thu Jun 21 17:24:49 CEST 2007


On Jun 21, 11:10 am, Duncan Booth <duncan.bo... at invalid.invalid>
wrote:
> Assuming they have Python installed normally there will be file
> associations set up for .py and .pyw, so all you need to do to type in
> the script name: Python itself does not need to be in the path.
> N.B. You do need to include the .py extension unless you can arrange to
> edit the PATHEXT environment variable.
>
> e.g.
>
> C:\Temp>type t.py
> import sys
> print sys.version
>
> C:\Temp>t.py
> 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)]
>
> C:\Temp>assoc .py
> .py=Python.File
>
> C:\Temp>ftype Python.File
> Python.File="C:\Python25\python.exe" "%1" %*

Wow, I knew there must be a simple solution, but I didn't know it was
that simple.  I feel sort of dumb now!  But thanks a lot, that saved
me a lot of work.





More information about the Python-list mailing list