我已经安装了psycopg2模块,但是我不能从这个库导入异常:
$ pip freeze | grep psycopg
psycopg2==2.7.7
$ python
Python 3.7.4 (default, Nov 5 2019, 17:21:00)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
>>> from psycopg2.errors import InsufficientPrivilege, UndefinedTable
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'psycopg2.errors'发布于 2021-08-03 08:03:44
@john-gordon mentioned.
错误是在2.8.版本中引入的
https://stackoverflow.com/questions/59218002
复制相似问题