19

关于导致以下错误的原因的任何想法?

我使用带有 openssl-devel.i386 0.9.8e-12.el5_5.7 的 Linux centos

$ easy_install PyOpenSSL
Searching for PyOpenSSL
Reading http://pypi.python.org/simple/PyOpenSSL/
Reading http://launchpad.net/pyopenssl
Reading http://pyopenssl.sourceforge.net/
Best match: pyOpenSSL 0.13
Downloading http://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.13.tar.gz#md5=767bca18a71178ca353dff9e10941929
Processing pyOpenSSL-0.13.tar.gz
Running pyOpenSSL-0.13/setup.py -q bdist_egg --dist-dir /tmp/easy_install-0Dunib/pyOpenSSL-0.13/egg-dist-tmp-aV6OCC
warning: no previously-included files matching '*.pyc' found anywhere in distribution
OpenSSL/ssl/connection.c: In function ‘ssl_Connection_set_context’:
OpenSSL/ssl/connection.c:289: warning: implicit declaration of function ‘SSL_set_SSL_CTX’
OpenSSL/ssl/connection.c: In function ‘ssl_Connection_get_servername’:
OpenSSL/ssl/connection.c:313: error: ‘TLSEXT_NAMETYPE_host_name’ undeclared (first use in this function)
OpenSSL/ssl/connection.c:313: error: (Each undeclared identifier is reported only once
OpenSSL/ssl/connection.c:313: error: for each function it appears in.)
OpenSSL/ssl/connection.c:320: warning: implicit declaration of function ‘SSL_get_servername’
OpenSSL/ssl/connection.c:320: warning: assignment makes pointer from integer without a cast
OpenSSL/ssl/connection.c: In function ‘ssl_Connection_set_tlsext_host_name’:
OpenSSL/ssl/connection.c:346: warning: implicit declaration of function ‘SSL_set_tlsext_host_name’
error: Setup script exited with error: command 'gcc' failed with exit status 1
4

9 回答 9

27

为了在 virtualenv 下安装它,您应该首先安装所需的软件包。在 ubuntu 上:

sudo apt-get install python-dev libffi-dev libssl-dev

然后你可以输入:

pip install pyopenssl
于 2014-07-16T10:14:54.817 回答
25

pyOpenSSL 0.13 引入了对 (S)erver (N)ame (I)ndication TLS 扩展的支持。此扩展允许客户端告诉服务器他们希望与之交谈的主机名,从而允许服务器选择合适的证书来呈现。

OpenSSL 0.9.8f 中引入了对 SNI 的支持。因此,pyOpenSSL 0.13 将使用 OpenSSL 0.9.8f 或更高版本构建,但不是 OpenSSL 0.9.8e 或更早版本,它期望包装的 API 不存在。

也许更新版本的 pyOpenSSL 将使这些绑定成为可选,恢复对 OpenSSL 0.9.8e 和更早版本的支持。但是,类似地,较新版本的 OpenSSL 也可以与 pyOpenSSL 0.13 一起使用。

pyOpenSSL 项目发布预发布。对预发布版本进行广泛测试有助于避免此类情况。我建议任何依赖 pyOpenSSL 的人订阅(非常低流量的)pyOpenSSL 用户列表(或在SourceForge 上),并在预发布版发布之前,在发布完成之前进行您可以做的测试。

于 2011-09-13T02:31:49.753 回答
6

我在尝试安装 Scrapy 时遇到了这个问题。对我来说,萨纳西斯的回答没有用。经过更多的谷歌和随机安装的东西

yum install python-devel

允许为我运行 Scrapy 安装(CentOS 版本 6.3(最终版))

于 2012-10-04T08:49:15.183 回答
6

不完全是问什么,但在Ubuntu 12.04中,它可以安装:

sudo apt-get install python-openssl
于 2013-01-02T12:08:10.647 回答
5

对我来说,我必须安装 openssl-devel 库:

yum install openssl-devel

试图安装 cyclone/tornado/twisted python evented lib。

于 2012-11-16T16:39:59.617 回答
2

如果不需要使用最新的pyOpenSSL,只需回滚到0.12,这是最简单的方法。

pip install pyOpenSSL==0.12

检查@Jean-Paul 的详细答案。

于 2014-01-15T06:58:57.480 回答
1

尝试安装:

sudo apt-get install -y python-dev libssl-dev libffi-dev

于 2015-03-09T18:12:35.867 回答
1

我无法安装 libssl-devel 或 libssl-dev,但这在 CentOS 6 上对我有用(之前安装了 pyOpenSSL 0.13.1):

sudo yum -y remove pyOpenSSL.x86_64
sudo yum -y install libffi-devel
#sudo yum -y install libssl-devel 
sudo yum -y install openssl-devel 
sudo yum -y install python-devel
sudo pip install pyopenssl
于 2015-12-02T17:16:20.313 回答
0

我们有同样的问题。检查了一下,我们找到了解决它的方法: https ://bugs.launchpad.net/pyopenssl/+bug/845445

您正在寻找的是“Philip 的修复在 CentOS 5.6 上对我有用:”: https ://bugs.launchpad.net/pyopenssl/+bug/845445/comments/9

这在我们的案例中效果很好。

于 2013-03-29T13:05:06.503 回答