python3.4>使用SQLAlchemy win32连接到PostGres SQL

2024-09-30 18:19:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我用的是Postgres和Pandas,但很难将两者连接起来。 我使用SQLAlchemy创建了enginestr,如下所示

from sqlalchemy import create_engine
engine = create_engine('postgresql://postgres:password@localhost:5432/bilal')

但是,当我运行该语句时,我得到以下错误

^{pr2}$

我试过安装模块,但没有任何运气。是因为我用的是32位的Windows机器吗?在

谢谢

比拉尔


Tags: fromimportlocalhostpandassqlalchemypostgresqlcreatepostgres
1条回答
网友
1楼 · 发布于 2024-09-30 18:19:56

你安装正确了吗? 使用此链接下载并安装win-psycopg或使用pip install psycopg2

您可以在连接字符串中指定它:

from sqlalchemy import create_engine

engine = create_engine('postgresql+psycopg2://postgres:password@localhost/bilal')

相关问题 更多 >