Vido
Vido

Reputation: 232

How to install psycopg2 for python 2.7

While isntaling binaryanalysis Iv got an error ImportError: No module named psycopg2 but I have installed it but its only avalible for python 3.5. How I can install it for python2.7 ?

Python 3.5

$ python3.5
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
>>> exit
Use exit()

Python 2.7

$ python2.7
Python 2.7.12 (default, Nov 20 2017, 18:23:56) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named psycopg2
>>> 

Edit:

$ pip install psycopg2 
Requirement already satisfied: psycopg2 in /usr/local/lib/python3.5/dist-packages

Upvotes: 4

Views: 8924

Answers (1)

Guru
Guru

Reputation: 302

Try this

pip install psycopg2-binary

I did this for Python 2.7, not sure if it works for Python 3.6

Upvotes: 4

Related Questions