The answer

alex23 wuwei23 at gmail.com
Sun Jan 17 23:15:27 EST 2010


On Jan 18, 12:30 pm, Jive Dadson <notonthe... at noisp.com> wrote:
> These instructions are for MS Windows.
>
> 1) Create your modules folder. Let's say it's named "Modules."  The
> documentation calls it a "package."
>
> 2) In an explorer window or on the desktop, right click on My Computer,
> and select Properties.
>
> 3) Select the Advanced tab, and click on Environment Variables near the
> bottom.
>
> 4) Look for an environment variable named PYTHONPATH.
>
>     a) If you do not find one, create one using the New button(s). I
> don't know if it has to be in User Variables or System Variables.  To
> save time experimenting, I just put one in both. For the value, put the
> full path of the folder Modules.
>
>     b) If there's already a PYTHONPATH,  Edit it, adding a semi-colon
> and the full path of folder Module to the end.
>
> 5) Put your module folders into the folder Module.
>
> 6) (Here's a really arcane bit.) Into each module folder, put a file
> named __init__.py.  It will be executed when you load the module.  It
> can be empty, but it has to be there or else the module folder will be
> ignored.

Actually, if you're using Python 2.6+/3.x, you can effectively skip
steps 1-5, as these versions now support user site-packages.

Rather than create a Module folder and modify your PYTHONPATH, add (if
it doesn't exist already) the following folder:
%APPDATA%/Python/Python26/site-packages

Modules can sit directly in the folder, or within packages.

For more details: http://www.python.org/dev/peps/pep-0370/



More information about the Python-list mailing list