Custom Search

Monday, June 1, 2015

How to import a module installed in /usr/local/lib/python2.7/dist-packages using pip

I am using ubuntu 14.04 and can see six in following locations.

/usr/lib/python2.7/dist-packages/six.py --- 1.5.2

/usr/local/lib/python2.7/dist-packages/six.py --- 1.9.0 (installed via #sudo pip install six)

I can't import six 1.9.0 which installed via pip
#python -c "import six; print six.__version__"
1.5.2
How to import a module installed in /usr/local/lib/python2.7/dist-packages using pip

Ans:
sounds like you installed it both from the platform's package manager and with pip. I recommend not doing that. (Dont' install with pip system-wide. Install in a virtualenv or with --user.)
There is no good way. Don't install packages system-wide except through your package manager.

Solution:

* Download debian package of python-six_1.9 and install it.
#wget http://ftp.us.debian.org/debian/pool/main/s/six/python-six_1.9.0-3_all.deb
 

#sudo apt-get install gdebi
 

#sudo gdebi python-six_1.9.0-3_all.deb
 

#python -c "import six; print six.__version__"
1.9.0












No comments:

Post a Comment