_psycopg psycopg2 not found

So, I used it psycopg2for a while, but only now I ran into this error when running our script.

Traceback (most recent call last):
  File "engine/LinkOracleEngine.py", line 8, in <module>
    from util.DoSQL import DoSQL
  File "/home/zero/Documents/Thesis/Source Code/engine/util/DoSQL.py", line 4, in <module>
    import psycopg2
  File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 50, in <module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: No module named _psycopg

Why? From my previous applications, there were no problems importing psycopg2, but now it was. I updated it and it seems no change, I even installed another one psycopg2through pip3, but it's still the same.

I even tried to import sysinto the python console, and then added the library where it was located ( /usr/lib/python2.7/dist-packages/psycopg2/) to sys.path, but still gets the same ImportError: No module named _psycopg.

>>> import sys
>>> sys.path.append('/usr/lib/python2.7/dist-packages/')
>>> import psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 50, in <module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: No module named _psycopg
>>> sys.path
['', '/opt/anaconda2/lib/python27.zip', '/opt/anaconda2/lib/python2.7', '/opt/anaconda2/lib/python2.7/plat-linux2', '/opt/anaconda2/lib/python2.7/lib-tk', '/opt/anaconda2/lib/python2.7/lib-old', '/opt/anaconda2/lib/python2.7/lib-dynload', '/home/zero/.local/lib/python2.7/site-packages', '/opt/anaconda2/lib/python2.7/site-packages', '/opt/anaconda2/lib/python2.7/site-packages/Sphinx-1.3.1-py2.7.egg', '/opt/anaconda2/lib/python2.7/site-packages/cryptography-1.0.2-py2.7-linux-x86_64.egg', '/opt/anaconda2/lib/python2.7/site-packages/setuptools-18.5-py2.7.egg', '/usr/lib/python2.7/dist-packages/']
>>> 

Last time, when I remembered that creating a cluster between my laptop and PC with mpichand mpich4py, but it seems that this does not directly affect mine psycopg2? Correct me if I am wrong.

+4

Source: https://habr.com/ru/post/1629878/


All Articles