adding new paths to sys.path

Jp Calderone exarkun at intarweb.us
Fri Mar 7 01:25:05 EST 2003


On Fri, Mar 07, 2003 at 12:57:07PM +0800, Jon Perez wrote:
> Under Slackware Linux, I've installed Python
> modules in /usr/local/lib/python2.2/site-packages
> instead of /usr/lib/python2.2/site-packages and
> now Python can't find the newer modules.
> 
> In the interactive command line, I can always
> add this new directory to sys.path, however,
> that won't do for scripts run from the command
> line.
> 
> What do I change to get these new package paths
> added to the default paths searched by Python
> when running a script?
> 

  In order of increasing suckfulness:

    1) Move the packages from /usr/local/lib/python2.2/site-packages/ to
    /usr/lib/python2.2/site-packages/

    2) Add /usr/local/lib/python2.2/site-packages/ to sys.path in
    /usr/lib/python2.2/site-packages/sitecustomize.py

    3) Add /usr/local/lib/python2.2/site-packages/ to your PYTHONPATH env
    var

  Jp


-- 
   Know what I pray for? The strength to change what I can, the inability to
accept what I can't and the incapacity to tell the difference.    -- Calvin
-- 
 up 3 days, 21:59, 5 users, load average: 0.00, 0.00, 0.00





More information about the Python-list mailing list