Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何将最新的openssl库与pyOpenSSL一起使用?_Python_Openssl_Pyopenssl - Fatal编程技术网

Python 如何将最新的openssl库与pyOpenSSL一起使用?

Python 如何将最新的openssl库与pyOpenSSL一起使用?,python,openssl,pyopenssl,Python,Openssl,Pyopenssl,我目前正在使用,它使用openssl1.0.1f,由系统安装。现在我从源代码安装openssl1.0.1j,并将新版本库路径设置为LD_library_path,此时,当我运行py文件时,它将产生错误: File "sslcert.py", line 5, in <module> from OpenSSL import SSL, _util, crypto ... File "/usr/local/lib/python2.7/dist-packages/cffi-0.8.6-py2

我目前正在使用,它使用openssl
1.0.1f
,由系统安装。现在我从源代码安装openssl
1.0.1j
,并将新版本库路径设置为
LD_library_path
,此时,当我运行py文件时,它将产生错误:

File "sslcert.py", line 5, in <module>
from OpenSSL import SSL, _util, crypto
...

File "/usr/local/lib/python2.7/dist-packages/cffi-0.8.6-py2.7-linux-x86_64.egg/cffi/vengine_cpy.py", line 149, in load_library
    raise ffiplatform.VerificationError(error)
cffi.ffiplatform.VerificationError:  
importing '/usr/local/lib/python2.7/dist-packages/cryptography-0.6.1-py2.7-linux-x86_64.egg/cryptography/_Cryptography_cffi_36a40ff0x2bad1bae.so':    
/usr/local/lib/python2.7/dist-packages/cryptography-0.6.1-py2.7-linux-x86_64.egg/cryptography/_Cryptography_cffi_36a40ff0x2bad1bae.so:  
symbol EC_GFp_nistp521_method, version OPENSSL_1.0.1 not defined in file libcrypto.so.1.0.0 with link time reference
文件“sslcert.py”,第5行,在
从OpenSSL导入SSL,_util,crypto
...
文件“/usr/local/lib/python2.7/dist packages/cffi-0.8.6-py2.7-linux-x86_64.egg/cffi/vengine_cpy.py”,第149行,加载库中
提升平台。验证错误(错误)
cffi.ffiplate.VerificationError:
导入“/usr/local/lib/python2.7/dist包/cryptography-0.6.1-py2.7-linux-x86_64.egg/cryptography/u cryptography_cffi_36a40ff0x2bad1bae.so”:
/usr/local/lib/python2.7/dist-packages/cryptography-0.6.1-py2.7-linux-x86_64.egg/cryptography//u cryptography_cffi_36a40ff0x2bad1bae.so:
符号EC_GFp_nistp521_方法,版本OPENSSL_1.0.1未在文件libcrypto.so.1.0.0中定义,带有链接时间参考

我想知道如何使用最新的openssl库来修复这个问题?

您可能需要针对较新版本的openssl重新编译

请确保您也安装了OpenSSL的开发头,然后重新构建(可能最容易的方法是重新安装)加密

升级OpenSSL的方式因平台而异。在Debian派生的系统上,这可能类似于
apt get install libssl dev
(这将获得库和开发头)。在RedHat派生的系统上,它可能更像
yum安装libssl-devel

您可能希望调查使用for this来将新构建的版本与已安装的版本分开

拥有virtualenv后,您可以使用pip安装加密技术

path/to/virtualenv/bin/pip install cryptography
或者,您可以升级现有安装:

path/to/virtualenv/bin/pip install --upgrade cryptography

还要注意的是加密项目。这些是包含所有依赖项(包括OpenSSL)的二进制软件包。因此,如果您所处的平台可以使用manylinux1控制盘,则不需要单独安装OpenSSL或其开发头。

您是否可以指定一些示例命令来重新编译密码或重新安装密码?添加了一些更详细的信息-但也请注意答案中新的manylinux1部分。时代变了。