我已安装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'