PATH or PYTHONPATH under Windows ???
Joe Salmeri
JoeSalmeri at hotmail.com
Tue Jun 5 19:23:45 EDT 2007
Modify the PATHEXT environment variable to include .py;
For example the default one on Windows XP is:
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;
Modify it so it says:
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.py
Now you can run python programs from your cmd prompt by just typing in the
script name (with or without the .py)
Instead of adding directories to your path so that you can easily run
programs (like python) try this instead.
Use notepad to create a file named alias.
Add lines to that file for the shortcuts you want.
For instance here is the shortcut I have for Python
p = P:\SW\python\python.exe $*
Modify the shortcut on the start menu for the command prompt from
%SystemRoot%\system32\cmd.exe /k doskey /macrofile=P:\SW\JoeUtil\Alias
to
%SystemRoot%\system32\cmd.exe /k doskey
/macrofile=<FULLY_QUALIFIED_PATH>\alias
Now when you use that shortcut for the command prompt it will run doskey
which will load your alias file.
With the above setup you can just type p at the cmd prompt to get the
interactive python prompt.
Since I have two versions of python installed right now I have another alias
setup
pold = P:\SW\python.2.4.2\python.exe $*
This allows me to compare differences between the two versions of python.
"Stef Mientki" <S.Mientki-nospam at mailbox.kun.nl> wrote in message
news:90155$4665db45$d443bb3a$16812 at news.speedlinq.nl...
> hello,
>
> after cleaning up a PC, Python can't find any libraries anymore.
> But happily I've still one PC, where Python is running perfect.
> Now I always read about the environment variable "PYTHONPATH".
> But on neither PC there exists a "PYTHONPATH".
>
> On the PC that works ok,
> there is the standard "PATH" environment variable,
> and indeed there are all the Python Library references.
>
> Please enlighten me.
>
> thanks,
> Stef Mientki
More information about the Python-list
mailing list