Reputation: 135
So I have a program I'm converting from python 2.7 to python 3.3. Everything works perfectly in 2.7, but in 3.3 I keep getting:
ImportError: No module named 'httplib2'
Now, I have httplib2 installed, and like I said, it works in python 2.7. The 2.7 version of the program and the 3.3 version are in the same directory, so I wouldn't think that would affect it. Anyone know what the issue is here?
The only relevant code snippets are:
import httplib2
from httplib2 import FileCache
Upvotes: 1
Views: 1268
Reputation: 128991
As others have mentioned, that means httplib2
is not installed into your Python 3 installation. Someone recommended you try this:
sudo python3 install setup.py
You mentioned that you got an error—for good reason. python3
takes the filename first. The command really should have been
sudo python3 setup.py install
Installing it this way or in another approved way (say, easy_install-3.3
or pip-3.3
) is required. The error you got installing it a different way suggests your installation skipped the 2to3
step, without which the package will contain Python 2 code, which Python 3 will occasionally choke on. Try uninstalling it the previous way and installing it this way.
Upvotes: 1
Reputation: 111
Try going to terminal and running:
sudo apt-get install python3-httplib2
I know you said you already had it installed, but I was getting the same error and the above resolved it.
Edit: Sorry, I see now you're on OSX. Can you translate the above to the proper command for Mac?
Upvotes: 1