【发布时间】:2020-03-18 20:00:36
【问题描述】:
尝试使用 Pony ORM 连接到 PostgreSQL 数据库。 从已安装软件包 pony 和 psycopg2 的 venv 运行脚本。 screenshot 但还是有例外:
D:\***\venv\Scripts\python.exe D:/***/models.py
Traceback (most recent call last):
File "D:\***\venv\lib\site-packages\pony\orm\dbproviders\postgres.py", line 9, in <module>
import psycopg2
File "D:\***\venv\lib\site-packages\psycopg2\__init__.py", line 50, in <module>
from psycopg2._psycopg import ( # noqa
ImportError: DLL load failed while importing _psycopg: Не найден указанный модуль.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\***\venv\lib\site-packages\pony\orm\dbproviders\postgres.py", line 12, in <module>
from psycopg2cffi import compat
ModuleNotFoundError: No module named 'psycopg2cffi'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/***/models.py", line 6, in <module>
db.bind(**DB_CONFIG)
File "D:\***\venv\lib\site-packages\pony\orm\core.py", line 769, in bind
self._bind(*args, **kwargs)
File "D:\***\venv\lib\site-packages\pony\orm\core.py", line 788, in _bind
provider_module = import_module('pony.orm.dbproviders.' + provider)
File "D:\***\venv\lib\site-packages\pony\utils\utils.py", line 219, in import_module
mod = __import__(name)
File "D:\***\venv\lib\site-packages\pony\orm\dbproviders\postgres.py", line 14, in <module>
raise ImportError('In order to use PonyORM with PostgreSQL please install psycopg2 or psycopg2cffi')
ImportError: In order to use PonyORM with PostgreSQL please install psycopg2 or psycopg2cffi
【问题讨论】:
标签: python-3.x postgresql ponyorm