Source code of Windows installer for Python interactive interpreter

Dave Angel d at davea.name
Fri Dec 28 10:55:09 EST 2012


On 12/28/2012 10:30 AM, philip.a.molloy at gmail.com wrote:
> I am writing a command-line application for Windows. I would like to review the Python source code to find out how to install my application so that it doesn't have to be called using the path and file name (i.e. being able to type `python` into the Command prompt, instead of `C:\path\to\executable\python.exe`). How does Python achieve this?

I use linux, ubuntu.  But I help others that use Windows, when necessary.

Last time I installed python from python.org on a Windows machine (years
ago), it didn't do such niceties for me.  For that and other reasons, I
switched to using the (free) version from ActiveState.  It has a number
of Windows extensions, and one of the extensions was actually fixing the
path and the registry so that Python was directly available at the
command line.

That all could have changed, of course.  But I'm assuming you just want
to fix Windows, not somehow duplicate whatever the installer didn't do?

Take a look in your install directory, same one that python.exe is
located in, and see if there is a batch file there, and whether it knows
where to find Python.exe.  If so, just copy that to somewhere on your
PATH, and you should be golden.  I always had a c:\bat directory on my
PATH for other purposes, so that was a perfect place to put it.

> Is the Python directory (i.e. "C:\Python33") assigned to the PATH variable using the Batch PATH built-in command? If so, where?

That's another option.  Of course, if everyone did that, the  PATH could
get mighty long.  And describing how to change the PATH globally is
tricky, since Microsoft seems to change it with every release of
Windows.  If you were trying to do that programmatically, there is a
registry entry somewhere.  And if I needed to find the right registry
entry, I'd put a weird directory name into the PATH the official way,
then use  regedit and F3 to search for the weird name.

-- 

DaveA




More information about the Python-list mailing list