gpt4 book ai didi

python-2.7 - NoSuchModuleError : Can't load plugin: sqlalchemy. 方言 :redshift. psycopg2

转载 作者:行者123 更新时间:2023-12-04 15:20:26 32 4
gpt4 key购买 nike

我正在尝试从我的 python 代码连接到 redshift。
我的 pip 安装:

psycopg2==2.6.1
redshift-sqlalchemy==0.4.1
SQLAlchemy==1.0.9

我的虚拟机有:
libpq-dev
python-psycopg2

但我仍然得到
 engine = create_engine('redshift+psycopg2://{}:{}@{}'.format(username, password, url))
File "/opt/project/env/local/lib/python2.7/site-packages/sqlalchemy/engine/__init__.py", line 386, in create_engine
return strategy.create(*args, **kwargs)
File "/opt/project/env/local/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 51, in create
entrypoint = u._get_entrypoint()
File "/opt/project/env/local/lib/python2.7/site-packages/sqlalchemy/engine/url.py", line 131, in _get_entrypoint
cls = registry.load(name)
File "/opt/project/env/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 205, in load
(self.group, name))
NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:redshift.psycopg2

使用相同的配置,我可以从我的笔记本电脑 (mac) 上运行,但是在 linux 上,我猜仍然缺少一些软件包?任何建议将不胜感激,谢谢!

最佳答案

我遇到了同样的问题,波纹管分辨率顺利解决了它。

环境:

Python 3.7

Conda 4.6.14



依赖:

sudo apt-get install python-pip

sudo apt-get install libpq-dev

pip install --user psycopg2

pip install --user sqlalchemy

pip install --user sqlalchemy-redshift



连接字符串:
connection_string = sa_url.URL(
drivername='postgresql+psycopg2',
username='admin',
password='admin',
host='redshiftone.********.us-west-2.redshift.amazonaws.com',
port='5439',
database='redshiftone')

关于python-2.7 - NoSuchModuleError : Can't load plugin: sqlalchemy. 方言 :redshift. psycopg2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33794074/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com