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

查看:99
本文介绍了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 恰到好处.我已经在几个 virtualenv 上安装了 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.

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

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 的回答,请确保包含-fs 标志在您使用 ln 命令时,有助于确保库不会在短时间内丢失.例如,

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天全站免登陆