在 psycopg2 中打开 postgres 连接导致 python 崩溃 [英] Opening a postgres connection in psycopg2 causes python to crash

查看:74
本文介绍了在 psycopg2 中打开 postgres 连接导致 python 崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试打开与 postgres 数据库的连接时收到以下错误消息.也许它与 OpenSSL 有关,但我无法理解错误消息.有人可以帮忙吗?

<预><代码>>>>导入 psycopg2>>>conn = psycopg2.connect(host = '', port = , dbname= '', 用户 = '', 密码 = '')自动配置失败12848:错误:02001015:系统库:fopen:是一个目录:.\crypto\bio\bss_file.c:169:fopen('D:/Build/OpenSSL/openssl-1.0.1h-vc9-x64/ssl/openssl.cnf','rb')12848:error:2006D002:BIO 例程:BIO_new_file:system lib:.\crypto\bio\bss_file.c:174:12848:错误:0E078002:配置文件例程:DEF_LOAD:系统库:.\crypto\conf\conf_def.c:199:

解决方案

我能想到的一个问题是您的安装可能没有正确链接/构建以使用 openssl.如果您还没有尝试过文档中列出的软件包,也许您可​​以尝试一下.

当我查看文档时:

<块引用>

微软视窗:

Jason Erickson 维护了一个打包的 Psycopg 的 Windows 端口,带有安装可执行文件.下载.双击.完成.

所以你可以尝试从那里安装它.或者你可以试试pip-friendly windows-friendly(注意:我自己没试过)psycopg2-windows 包.

I'm getting the following error message when I try to open up a connection to a postgres database. Perhaps it's related to OpenSSL, but I can't understand the error message. Can anyone help?

>>> import psycopg2
>>> conn = psycopg2.connect(host = '', port = , dbname
 = '', user = '', password = '')
Auto configuration failed
12848:error:02001015:system library:fopen:Is a directory:.\crypto\bio\bss_file.c
:169:fopen('D:/Build/OpenSSL/openssl-1.0.1h-vc9-x64/ssl/openssl.cnf','rb')
12848:error:2006D002:BIO routines:BIO_new_file:system lib:.\crypto\bio\bss_file.
c:174:
12848:error:0E078002:configuration file routines:DEF_LOAD:system lib:.\crypto\co
nf\conf_def.c:199:

解决方案

One problem that I can think of is that your installation may not have been linked/built properly to use openssl. If you haven't tried the packages listed in the docs yet, maybe you could give it a try.

When I look at the docs:

Microsoft Windows:

Jason Erickson maintains a packaged Windows port of Psycopg with installation executable. Download. Double click. Done.

So you could try to install it from there. Or you can try the pip-friendly windows-friendly (note: I didn't try it myself) psycopg2-windows package.

这篇关于在 psycopg2 中打开 postgres 连接导致 python 崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆