I'm working in a brand new Python virtualenv. I've just installed httplib2
using pip, but Python cannot see it.
(venv)$ sudo pip install httplib2
Requirement already satisfied (use --upgrade to upgrade): httplib2 in
/usr/local/lib/python2.7/dist-packages
Cleaning up...
(venv)$ python
Python 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import httplib2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named httplib2
From my reading, it sounds like this is probably a path problem, but I don't know why it is happening, or how to fix it :(
This is the content of sys.path
:
>>> pprint(sys.path)
['',
'/var/apps/ttex/venv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg',
'/var/apps/ttex/venv/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg',
'/var/apps/ttex/venv/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg',
'/var/apps/ttex/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg',
'/var/apps/ttex/venv/lib/python2.7',
'/var/apps/ttex/venv/lib/python2.7/plat-linux2',
'/var/apps/ttex/venv/lib/python2.7/lib-tk',
'/var/apps/ttex/venv/lib/python2.7/lib-old',
'/var/apps/ttex/venv/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/var/apps/ttex/venv/local/lib/python2.7/site-packages',
'/var/apps/ttex/venv/lib/python2.7/site-packages']
Oddly though, if I run Python 2.7, I can see the package:
(venv)$ python2.7
>>> import httplib2
>>>
Why is this happening and what can I do about it?
Sorry if this is a duplicate, there are lots of questions around this topic, but none seem to give a simple definitive answer.