Python: Packages in user site do not override dist packages on ubuntu

I am using ubuntu 13.04. When developing in python, I sometimes want to use newer versions of some packages than those that come with ubuntu. In these cases, the method I'm used to is installing the package only in my user account, for example, like this (for the package six):

$ pip install --user --upgrade six

This correctly installs the latest version (1.4.1) of the six in my home directory. However, when I download the newly installed package, python selects the version installed in the system-wide version:

$ python -c "import six; print six; print six.__version__"                                                     
<module 'six' from '/usr/lib/python2.7/dist-packages/six.pyc'>
1.2.0

This, in my opinion, is a strange behavior; Manually installed packages I tried the same procedure on Arch Linux, where the user site package is loaded first. My sys.path:

$ python -c "import sys; print sys.path"                                                                       
['', '/home/jostein/.local/lib/python2.7/site-packages/enaml-0.5.1-py2.7.egg', '/usr/lib/python2.7/dist-packages', '/home/jostein/Programming/scikit-image', '/home/jostein/Programming/reconstruct', '/home/jostein/Programming/ptychography', '/home/jostein/Programming', '/home/jostein', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/home/jostein/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']

/usr/lib/python2.7/dist-packages , , , , .

- ubuntu?

+4
1

dist IMHO. : .

- PYTHONPATH, dir . , , , .

, , , virtualenv.

+1

All Articles