【问题标题】:Cryptography Upgrade Issue on OSXOSX 上的加密升级问题
【发布时间】:2020-04-03 02:30:34
【问题描述】:

我正在尝试安装 Scrapy,但遇到了 openssl 错误。所有论坛似乎都建议应该通过更新密码学来解决这个问题,但我在升级它时也遇到了错误。

我正在运行 macOS Catalina 10.15.1。我已经更新了我的 xcode、pip 和 brew。我该如何解决这个问题?

$ pip install cryptography

WARNING: Executing a script that is loading libcrypto in an unsafe way. This will fail in a future version of macOS. Set the LIBRESSL_REDIRECT_STUB_ABORT=1 in the environment to force this into an error.
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: cryptography in /Library/Python/2.7/site-packages (2.1.3)
Requirement already satisfied: cffi>=1.7; platform_python_implementation != "PyPy" in /Library/Python/2.7/site-packages (from cryptography) (1.11.2)
Requirement already satisfied: enum34; python_version < "3" in /Library/Python/2.7/site-packages (from cryptography) (1.1.6)
Requirement already satisfied: asn1crypto>=0.21.0 in /Library/Python/2.7/site-packages (from cryptography) (0.23.0)
Requirement already satisfied: idna>=2.1 in /Library/Python/2.7/site-packages (from cryptography) (2.6)
Requirement already satisfied: six>=1.4.1 in /Library/Python/2.7/site-packages (from cryptography) (1.11.0)
Requirement already satisfied: ipaddress; python_version < "3" in /Library/Python/2.7/site-packages (from cryptography) (1.0.18)
Requirement already satisfied: pycparser in /Library/Python/2.7/site-packages (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography) (2.18)
From cffi callback <function _verify_callback at 0x10e937230>:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)) - skipping


$ pip install Scrapy

WARNING: Executing a script that is loading libcrypto in an unsafe way. This will fail in a future version of macOS. Set the LIBRESSL_REDIRECT_STUB_ABORT=1 in the environment to force this into an error.
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
From cffi callback <function _verify_callback at 0x10f9acc08>:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)': /simple/scrappy/

【问题讨论】:

    标签: python pip scrapy openssl


    【解决方案1】:

    这个问题是一堆依赖项之间的复杂交互,最终破坏了 pip 通过 TLS 获取内容的能力,但简单的解决方法是使用浏览器从 https://pypi.org/project/cryptography/#files 下载正确的轮子文件,然后输入 pip install /path/to/wheel/wheel-file.whl .在撰写本文时,应该为您工作的 Wheel 文件是 cryptography-2.8-cp27-cp27m-macosx_10_6_intel.whl

    【讨论】:

    • 谢谢!这行得通,除了我必须进行一次调整,因为我当前的用户配置文件显然无权访问包含该文件的文件夹 - 我猜这是另一天的单独问题。无论如何,这对我有用:sudo -H pip install cryptography-2.8-cp27-cp27m-macosx_10_6_intel.whl
    猜你喜欢
    • 1970-01-01
    • 2015-12-08
    • 2021-01-02
    • 2014-08-21
    • 1970-01-01
    • 2020-03-07
    • 1970-01-01
    • 2016-05-26
    • 1970-01-01
    相关资源
    最近更新 更多