postgresql用sqlaichemy连接问题集

参考可用代码:python使用sqlalchemy连接postgresql数据库

 

1.运行时报错如下:

sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgressqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres

解决方法:

第一步,安装pyhive

pip install pyhive

第二步,修改连接写法

engine = create_engine('postgres://postgres:3.1415926@localhost:5432/postgres')

修改为

engine = create_engine('postgresql://postgres:3.1415926@localhost:5432/postgres')

 

2.运行时报错如下:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 3: inva

解决方法:

我的电脑->计算机名称设置->去掉所有中文.

 

posted @ 2022-06-01 10:36  毛绒绒  阅读(877)  评论(0编辑  收藏  举报