【问题标题】:python(twisted) gives error in openssl installation in MAC?python(twisted) 在 MAC 中安装 openssl 时出错?
【发布时间】:2017-09-14 00:46:03
【问题描述】:

我已经在 MAC(V 10.11.3) 中安装了 Openssl

# brew upgrade
#brew install openssl
Warning: openssl 1.0.2l is already installed

我也运行了以下命令;

easy_install PyOpenSSL

easy_install PyCrypto

所有这些命令安装都没有问题。

并尝试将 openssl 与 brew 链接

#brew link openssl

得到

Warning: Refusing to link: openssl

    Linking keg-only openssl means you may end up linking against the insecure,
    deprecated system OpenSSL while using the headers from Homebrew's openssl.
    Instead, pass the full include/library paths to your compiler e.g.:
      -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

但如果我尝试;

 brew link /usr/local/opt/openssl/bin --force (or, **lib**, **include** folders)

所有地点都一样

Error: No available formula with the name "/usr/local/opt/openssl/bin"

现在当我在 python 命令提示符下尝试时;

>>> from twisted.internet import reactor, endpoints

我收到以下错误

AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'

完整的错误堆栈

 File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/Twisted-17.9.0rc1-py2.7-macosx-10.11-intel.egg/twisted/internet/reactor.py", line 38, in <module>
    from twisted.internet import default
  File "/Library/Python/2.7/site-packages/Twisted-17.9.0rc1-py2.7-macosx-10.11-intel.egg/twisted/internet/default.py", line 56, in <module>
    install = _getInstallFunction(platform)
  File "/Library/Python/2.7/site-packages/Twisted-17.9.0rc1-py2.7-macosx-10.11-intel.egg/twisted/internet/default.py", line 50, in _getInstallFunction
    from twisted.internet.selectreactor import install
  File "/Library/Python/2.7/site-packages/Twisted-17.9.0rc1-py2.7-macosx-10.11-intel.egg/twisted/internet/selectreactor.py", line 18, in <module>
    from twisted.internet import posixbase
  File "/Library/Python/2.7/site-packages/Twisted-17.9.0rc1-py2.7-macosx-10.11-intel.egg/twisted/internet/posixbase.py", line 18, in <module>
    from twisted.internet import error, udp, tcp
  File "/Library/Python/2.7/site-packages/Twisted-17.9.0rc1-py2.7-macosx-10.11-intel.egg/twisted/internet/tcp.py", line 28, in <module>
    from twisted.internet._newtls import (
  File "/Library/Python/2.7/site-packages/Twisted-17.9.0rc1-py2.7-macosx-10.11-intel.egg/twisted/internet/_newtls.py", line 21, in <module>
    from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
  File "/Library/Python/2.7/site-packages/Twisted-17.9.0rc1-py2.7-macosx-10.11-intel.egg/twisted/protocols/tls.py", line 63, in <module>
    from twisted.internet._sslverify import _setAcceptableProtocols
  File "/Library/Python/2.7/site-packages/Twisted-17.9.0rc1-py2.7-macosx-10.11-intel.egg/twisted/internet/_sslverify.py", line 38, in <module>
    TLSVersion.TLSv1_1: SSL.OP_NO_TLSv1_1,
AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'
>>> 

我该如何解决这个问题?

编辑

如果我尝试

>>> import OpenSSL

没有打印

但如果我尝试

>>> import twisted.internet.ssl

我遇到了上述问题。

我安装了以下扭曲版本;

>>> import twisted
>>> twisted.__version__
'17.9.0rc1'
>>> 

【问题讨论】:

    标签: python macos python-2.7 twisted


    【解决方案1】:

    我通过安装最新版本的 twisted

    解决了这个问题
    #sudo pip install twisted==13.1.0
    

    【讨论】:

    • 这既不是 Twisted 的最新版本,也不是在任何系统上安装它 (sudo pip ...) 的正确方法。 ://
    猜你喜欢
    • 2015-10-06
    • 1970-01-01
    • 1970-01-01
    • 2013-05-10
    • 2015-02-12
    • 2012-04-02
    • 2019-01-20
    • 2018-11-19
    • 2015-06-21
    相关资源
    最近更新 更多