ImportError:没有名为postgresql的模块,已安装psycopg2

对于安装OpenGnSys,我们需要运行脚本,然后调用python脚本。这python脚本提供了以下错误:ImportError:没有名为postgresql的模块,已安装psycopg2

[[email protected] opengnsys2-web]# ./db.py 

postgresql://opengnsys:[email protected]/opengnsys

Traceback (most recent call last):

File "./db.py", line 88, in <module>

create()

File "./db.py", line 81, in create

db = create_engine(database, echo=False)

File "/usr/lib/python2.6/site-packages/sqlalchemy/engine/__init__.py", line 223, in create_engine

return strategy.create(*args, **kwargs)

File "/usr/lib/python2.6/site-packages/sqlalchemy/engine/strategies.py", line 48, in create

dialect_cls = u.get_dialect()

File "/usr/lib/python2.6/site-packages/sqlalchemy/engine/url.py", line 91, in get_dialect

module = getattr(__import__('sqlalchemy.databases.%s' % self.drivername).databases, self.drivername)

ImportError: No module named postgresql

净搜索后,我发现,模块psycopg2应安装postgesql。但就我而言,它已经在那里。可能是什么问题?

回答:

Are we talking about a misconfiguration of the url

postgresql://opengnsys:[email protected]/opengnsys 

VS

postgresql+psycopg2://scott:[email protected]/mydatabase 

以上是 ImportError:没有名为postgresql的模块,已安装psycopg2 的全部内容, 来源链接: utcz.com/qa/259550.html

回到顶部