Distutils does honor PYTHONUSERBASE, but it only does so when using --user (which is what I expect). When I do *not* use --user whether PYTHONUSERBASE is set or not should not matter, but in ubuntu it does. Let me try to show what I mean with an example:
Create a setup.py containing just:
from distutils.core import setup; setup(py_modules=['bug'])
bug.py is an empty file in the same directory.
Now with PYTHONUSERBASE unset:
"python setup.py install" installs into /usr/local/lib/python2.6/dist-packages/bug.py
"python setup.py install --user" installs into /home/marienz/.local/lib/python2.6/site-packages
With PYTHONUSERBASE=$HOME:
"python setup.py install" installs into /usr/lib/python2.6/site-packages
"python setup.py install --user" installs into /home/marienz/lib/python2.6/site-packages/bug.py
The behavior of "python setup.py install --user" is what I expect: python is honoring PYTHONUSERBASE just fine there. What I do not understand is why PYTHONUSERBASE is affecting "setup.py install" *without* --user. After all the documentation says this sets the *user-specific* site directory, defaulting to ~/.local. "python setup.py --install" *without* --user should not care about what the user-specific site directory is.
Distutils does honor PYTHONUSERBASE, but it only does so when using --user (which is what I expect). When I do *not* use --user whether PYTHONUSERBASE is set or not should not matter, but in ubuntu it does. Let me try to show what I mean with an example:
Create a setup.py containing just:
from distutils.core import setup; setup(py_ modules= ['bug'] )
bug.py is an empty file in the same directory.
Now with PYTHONUSERBASE unset: lib/python2. 6/dist- packages/ bug.py .local/ lib/python2. 6/site- packages
"python setup.py install" installs into /usr/local/
"python setup.py install --user" installs into /home/marienz/
With PYTHONUSERBASE= $HOME: python2. 6/site- packages lib/python2. 6/site- packages/ bug.py
"python setup.py install" installs into /usr/lib/
"python setup.py install --user" installs into /home/marienz/
The behavior of "python setup.py install --user" is what I expect: python is honoring PYTHONUSERBASE just fine there. What I do not understand is why PYTHONUSERBASE is affecting "setup.py install" *without* --user. After all the documentation says this sets the *user-specific* site directory, defaulting to ~/.local. "python setup.py --install" *without* --user should not care about what the user-specific site directory is.