在SQLAlchemy中使用py-postgresql引发了没有名为postgresql.driver的模块

时间:2016-08-15 16:53:16

标签: python postgresql sqlalchemy

我想在SQLAlchemy中使用py-postgresql驱动程序。但是,我得到以下ImportError。我使用的是Python 2.7。

Traceback (most recent call last):
  File "/home/ed/projects/wiki/main.py", line 3, in <module>
    from database import db_session as db
  File "/home/ed/projects/wiki/database.py", line 5, in <module>
    engine = create_engine('postgresql+pypostgresql://ed:noles98@127.0.0.1:5432/wiki', convert_unicode=True)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/__init__.py", line 386, in create_engine
    return strategy.create(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 75, in create
    dbapi = dialect_cls.dbapi(**dbapi_args)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/dialects/postgresql/pypostgresql.py", line 65, in dbapi
    from postgresql.driver import dbapi20
ImportError: No module named postgresql.driver

0 个答案:

没有答案