我正在尝试在我的本地Mac OS X上运行带有Postgresql后端的Django.我已经使用pip安装了Django:
sudo pip install Django
Run Code Online (Sandbox Code Playgroud)
我已经安装PostgreSQL用于二进制安装程序之一在这里.
但是当我尝试安装psycopg2时,我得到一个错误(粘贴在下面),它找不到pg_config.
从这个问题看来我应该安装,libpq-dev
但我不确定如何.
我尝试libpqxx
使用MacPorts 安装,但是没有做任何事情.
如何安装libpg-dev?或者还有其他我想念的东西?
henrietta:~ $ pip install psycopg2
Downloading/unpacking psycopg2
Downloading psycopg2-2.4.5.tar.gz (719Kb): 719Kb downloaded
Running setup.py egg_info for package psycopg2
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
Complete output from command …
Run Code Online (Sandbox Code Playgroud) 我的公司最近更改了我们的Redshift集群,现在它们需要SSL连接。过去,我通过此处详细介绍的方法将Python / pandas连接到Redshift:http : //measureallthethin.gs/blog/connect-python-and-pandas-to-redshift/
从SQLAlchemy文档看来,我需要做的就是添加connect_args={'sslmode':'require'}
到create_engine()
调用中,正如该线程指出的那样:如何使用来自SqlAchemy + pg8000的SSL连接到Postgresql?
但是,我现在收到此错误:
OperationalError:(psycopg2.OperationalError)sslmode值“ require”在未编译SSL支持时无效
我将Anaconda发行版用于许多软件包,并且发现我需要按照以下说明更新psycopg2软件包:https : //groups.google.com/a/continuum.io/d/msg/conda/Fqv93VKQXAc/mHqfNK8xZWsJ
但是,即使在更新了psycopg2之后,我仍然遇到相同的错误,并且在如何进行进一步调试方面不知所措。我想弄清楚这一点,以便可以将Redshift数据直接输入到熊猫中。
我正在尝试通过 SSL 连接到 AWS Redshift 服务器。我在 python 中使用 psycopg2 库来建立连接并用作sslmode='require'
连接线中的参数。不幸的是我收到了这个错误:
sslmode value "require" invalid when SSL support is not compiled in
Run Code Online (Sandbox Code Playgroud)
我阅读了许多其他类似的 PostgreSQL 案例,其中提到 PostgeSQL 版本存在问题,但我没有找到任何使用 Psycopg2 的 Redshift 解决方案。我是否需要为 Redshift 安装任何特定的 SSL 证书?如果是,我该如何使用 Psycopg2 进行操作?任何帮助将不胜感激。