0

how can a Python version be forced to look at a particular local user site/user base for packages? I tried setting the environment variable PYTHONUSERBASE but it is ignored. Typing this:

$ python -m site --user-base

gives no output, similarly for

$ python -m site --user-site

I am also not clear what the difference is between user base and user site. when python is invoked, it always looks in the system wide site-packages, like /usr/lib/... and not the directory I specified in PYTHONUSERBASE.

How can this be configured? Relevant doc: https://docs.python.org/2/library/site.html

  • 1
    Is the problem that you cannot find a package or that you are finding an undesirable version of a package? – merlin2011 May 03 '14 at 19:24
  • merlin2011: the problem is that it uses the system wide location of the package, which is older than the one i have installed in my local directory. i want it to always look in `~/.local/` *first*, but it doesn't –  May 03 '14 at 19:26
  • Please link the relevant documentation in your question. – merlin2011 May 03 '14 at 19:29
  • What exactly are you setting `PYTHONUSERBASE` to, and where are the user packages located? – merlin2011 May 03 '14 at 19:33
  • @merlin2011: I set `PYTHONUSERBASE` to `~/.local/` and the packages are in `~/.local/lib/python...` the usual directory. –  May 03 '14 at 19:45
  • I think user site-packages is designed as an additional entry in the module search path, after the global site-packages; it’s not supposed to be inserted before it. PEP 370 should contain all info. Virtualenvs or buildout would be a way to make Python use a local version that’s newer than a globally installed version. – merwok May 04 '14 at 18:00

0 Answers0