Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: "No modules named". But modules already installed in dist-packages

I am using python2.7 and trying to import modules such as psycopg2. But I get the following error when I try to import the module:

import psycopg2
ImportError: No module named psycopg2

When I try pip to install the module it gives me the following message:

Requirement already satisfied (use --upgrade to upgrade): psycopg2 in /usr/local/lib/python2.7/dist-packages
Cleaning up...

Can anyone please tell me what I am doing wrong?

like image 905
shekar Avatar asked Aug 04 '14 13:08

shekar


1 Answers

Is the module installed in your PYTHONPATH?

You can verify running this command line:

python -c "import sys; print '/usr/local/lib/python2.7/dist-packages' in sys.path"
like image 115
Massimo Costa Avatar answered Sep 19 '22 15:09

Massimo Costa