Understanding .pth in site-packages
Peter Otten
__peter__ at web.de
Sat Aug 27 13:29:07 EDT 2011
Josh English wrote:
> I have a development version of a library in c:\dev\XmlDB\xmldb
>
> After testing the setup script I also have
> c:\python27\lib\site-packages\xmldb
>
> Now I'm continuing to develop it and simultaneously building an
> application with it.
>
> I thought I could plug into my site-packages directory a file called
> xmldb.pth with:
>
> c:\dev\XmlDB\xmldb
>
> which should redirect import statements to the development version of the
> library.
>
> This doesn't seem to work.
You have to put the directory containing the package into the pth-file.
That's probably
c:\dev\XmlDB
in your case. Also, Python will stop at the first matching module or
package; if you keep c:\python27\lib\site-packages\xmldb that will shadow
c:\dev\XmlDB\xmldb.
%APPDATA%/Python/Python26/site-packages
may be a good place for the pth-file (I'm not on Windows and too lazy to
figure out where %APPDATA% actually is. The PEP
http://www.python.org/dev/peps/pep-0370/ may help)
More information about the Python-list
mailing list