setting PYTHONPATH to override system wide site-packages
perfreem at gmail.com
Sun Mar 1 05:53:45 CET 2009
On Feb 28, 11:24 pm, Carl Banks <pavlovevide... at gmail.com> wrote:
> On Feb 28, 7:30 pm, per <perfr... at gmail.com> wrote:
> > hi all,
> > i recently installed a new version of a package using python setup.py
> > install --prefix=/my/homedir on a system where i don't have root
> > access. the old package still resides in /usr/lib/python2.5/site-
> > packages/ and i cannot erase it.
> > i set my python path as follows in ~/.cshrc
> > setenv PYTHONPATH /path/to/newpackage
> > but whenever i go to python and import the module, the version in site-
> > packages is loaded. how can i override this setting and make it so
> > python loads the version of the package that's in my home dir?
> What happens when you run the command "print sys.path" from the Python
> prompt? /path/to/newpackage should be the second item, and shoud be
> listed in front of the site-packages dir.
> What happens when you run "print os.eviron['PYTHONPATH']" at the
> Python interpreter? It's possible that the sysadmin installed a
> script that removes PYTHONPATH environment variable before invoking
> Python. What happens when you type "which python" at the csh prompt?
> What happens when you type "ls /path/to/newpackage" at your csh
> prompt? Is the module you're trying to import there?
> You approach should work. These are just suggestions on how to
> diagnose the problem; we can't really help you figure out what's wrong
> without more information.
> Carl Banks
i am setting it programmatically now, using:
sys.path = [....]
sys.path now looks exactly like what it looked like before, except the
second element is my directory. yet when i do
i still get the old version...
any other ideas?
More information about the Python-list