python pip install psycopg2安装错误 [英] python pip install psycopg2 install error

查看:715
本文介绍了python pip install psycopg2安装错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac系统上做了一个简单的pip install psycopg2.它安装正常,但是当我尝试使用psycopg2时出现错误:

I did a simple pip install psycopg2 on mac system. It installed fine, but when I try to use psycopg2 I get the error:

Reason: Incompatible library version: _psycopg.so requires version 1.0.0 or later, but libssl.0.9.8.dylib provides version 0.9.8

pip freeze恰好显示psycopg2==2.4.5.我已经在多个virtualenvs上安装了psycopg2,但这是我第一次看到这样的错误.我尝试卸载并重新安装,结果相同.请帮助

pip freeze shows psycopg2==2.4.5 just right. I have installed psycopg2 on several virtualenvs but this is the first time I am seeing such error. I tried uninstalling and reinstalling, same results. Please help

推荐答案

升级到Mountain Lion后,我遇到了类似的问题.

I ran into a similar problem after upgrading to Mountain Lion.

要确保/usr/lib/libssl.dylib实际上是到库的最新版本的软链接,而不是按照Slack的建议复制libssl.*文件.

Instead of copying libssl.* files per Slack's suggestion, make sure that /usr/lib/libssl.dylib is actually a soft link to the most up-to-date version of the library.

例如,在我的计算机上,ls -l /usr/lib/libssl*给出:

E.g., on my machine, ls -l /usr/lib/libssl* gives:

lrwxr-xr-x  1 root  wheel    46B Jun 27 15:24 /usr/lib/libssl.1.0.0.dylib -> /Library/PostgreSQL/9.1/lib/libssl.1.0.0.dylib
lrwxr-xr-x  1 root  wheel    27B Jul 30 10:31 /usr/lib/libssl.dylib -> /usr/lib/libssl.1.0.0.dylib

如果libssl.dylib没有链接到错误版本提到的版本,请确保您具有该库的版本,然后确保/usr/lib/libssl.dylib指向该库,而不是较旧的版本.

If libssl.dylib doesn't link to the version that the error version mentions, make sure you have that version of the library, and then make sure /usr/lib/libssl.dylib points to it, and not an older version.

如果该链接不存在,请像这样创建它

If the link doesn't exist, create it like so

sudo ln -s library_to_link_to link_to_create

当然使用适合您机器的位置.对我来说,结果是:

using, of course, the proper locations for your machine. For me, this turned out to be:

sudo ln -s /usr/lib/libssl.1.0.0.dylib /usr/lib/libssl.dylib

修改:

似乎有些人在解决我的问题时遇到了麻烦.也就是说,删除这些重要的库甚至会暂时导致操作系统出现问题.

It seems like some are having trouble with part of my solution. Namely, deleting these important libraries even temporarily causes problems with the operating system.

每个 Purrell的答案,请确保包括使用ln命令时,会使用-fs标志,这有助于确保库在短时间内不会丢失.例如,

Per Purrell's answer, make sure you include the -fs flags when you use the ln command, which helps ensure that the libraries don't go missing for a short period of time. E.g.,

sudo ln -fs /usr/lib/libssl.1.0.0.dylib /usr/lib/libssl.dylib
sudo ln -fs /usr/lib/libcrypto.1.0.0.dylib /usr/lib/libcrypto.dylib

这篇关于python pip install psycopg2安装错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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