无法为Python 2.7.11安装openssl-devel

时间:2017-01-23 09:45:59

标签: python linux cryptography

当我安装加密时,有一些错误,因为平台是:

[root@RHanible ~]# python -V
Python 2.7.11
[root@RHanible ~]# rpm -qa openssl
openssl-1.0.0-20.el6.x86_64
[root@RHanible ~]# rpm -qa openssl-devel
openssl-devel-1.0.0-20.el6.x86_64
[root@RHanible ~]# rpm -qa python-devel
python-devel-2.6.6-29.el6.x86_64
[root@RHanible ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.2 (Santiago)

错误如下:

already up-to-date
building '_openssl' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/python/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o
build/temp.linux-x86_64-2.7/_openssl.c:2078: warning: function declaration isn?. a prototype
build/temp.linux-x86_64-2.7/_openssl.c:2079: warning: function declaration isn?. a prototype
build/temp.linux-x86_64-2.7/_openssl.c:2080: warning: function declaration isn?. a prototype
build/temp.linux-x86_64-2.7/_openssl.c:2105: warning: function declaration isn?. a prototype
build/temp.linux-x86_64-2.7/_openssl.c:2163: warning: function declaration isn?. a prototype
build/temp.linux-x86_64-2.7/_openssl.c: In function ?.cffi_const_CMS_DEBUG_DECRYPT?.
build/temp.linux-x86_64-2.7/_openssl.c:8193: error: ?.MS_DEBUG_DECRYPT?.undeclared (first use in this function)
build/temp.linux-x86_64-2.7/_openssl.c:8193: error: (Each undeclared identifier is reported only once
build/temp.linux-x86_64-2.7/_openssl.c:8193: error: for each function it appears in.)
error: command 'gcc' failed with exit status 1

1 个答案:

答案 0 :(得分:0)

我使用了以下步骤,它在我的虚拟环境中对我有用。首先,我安装了python开发头文件和libevent头文件。

sudo apt-get install python-dev 

sudo apt-get install libevent-dev

然后,我用了文档 https://cryptography.io/en/latest/installation/#building-cryptography-on-linux