我已经安装了psycopg2,甚至有一个金字塔网站使用驱动程序成功连接到数据库,但现在我无法使用SQLAlchemy脚手架。
为什么会出现导入错误?
我已将此添加到development.ini
sqlalchemy.url = postgresql://postgres@localhost:5432/test
尝试启动服务器:
../bin/pserve development.ini --reload
错误:
File "build/bdist.macosx-10.8-intel/egg/sqlalchemy/engine/__init__.py", line 357, in engine_from_config
File "build/bdist.macosx-10.8-intel/egg/sqlalchemy/engine/__init__.py", line 335, in create_engine
File "build/bdist.macosx-10.8-intel/egg/sqlalchemy/engine/strategies.py", line 73, in create
File "build/bdist.macosx-10.8-intel/egg/sqlalchemy/dialects/postgresql/psycopg2.py", line 371, in dbapi
ImportError: No module named psycopg2
我是否需要将其安装到我为这个新站点创建的python虚拟环境中?
答案 0 :(得分:0)
这对我有用:
bin/easy_install psycopg2