【问题标题】:issue with python 2.7 paramiko , in MAC OS ElcapitanMAC OS El Capitan 中的 python 2.7 paramiko 问题
【发布时间】:2016-05-17 07:57:52
【问题描述】:

我在 Mac OS Elcapitan 中遇到 paramiko 的问题,安装后它不起作用

DEB [20160517-10:48:54.068] thr=1   paramiko.transport: starting thread (client mode): 0xa552350L
DEB [20160517-10:48:54.068] thr=1   paramiko.transport: Local version/idstring: SSH-2.0-paramiko_2.0.0
DEB [20160517-10:48:54.477] thr=1   paramiko.transport: Remote version/idstring: SSH-2.0-OpenSSH_6.0
INF [20160517-10:48:54.477] thr=1   paramiko.transport: Connected (version 2.0, client OpenSSH_6.0)
DEB [20160517-10:48:54.890] thr=1   paramiko.transport: kex algos:[u'ecdh-sha2-nistp256', u'ecdh-sha2-nistp384', u'ecdh-sha2-nistp521', u'diffie-hellman-group-exchange-sha256', u'diffie-hellman-group-exchange-sha1', u'diffie-hellman-group14-sha1', u'diffie-hellman-group1-sha1'] server key:[u'ssh-rsa', u'ssh-dss', u'ecdsa-sha2-nistp256'] client encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'arcfour256', u'arcfour128', u'aes128-cbc', u'3des-cbc', u'blowfish-cbc', u'cast128-cbc', u'aes192-cbc', u'aes256-cbc', u'arcfour', u'rijndael-cbc@lysator.liu.se'] server encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'arcfour256', u'arcfour128', u'aes128-cbc', u'3des-cbc', u'blowfish-cbc', u'cast128-cbc', u'aes192-cbc', u'aes256-cbc', u'arcfour', u'rijndael-cbc@lysator.liu.se'] client mac:[u'hmac-md5', u'hmac-sha1', u'umac-64@openssh.com', u'hmac-sha2-256', u'hmac-sha2-256-96', u'hmac-sha2-512', u'hmac-sha2-512-96', u'hmac-ripemd160', u'hmac-ripemd160@openssh.com', u'hmac-sha1-96', u'hmac-md5-96'] server mac:[u'hmac-md5', u'hmac-sha1', u'umac-64@openssh.com', u'hmac-sha2-256', u'hmac-sha2-256-96', u'hmac-sha2-512', u'hmac-sha2-512-96', u'hmac-ripemd160', u'hmac-ripemd160@openssh.com', u'hmac-sha1-96', u'hmac-md5-96'] client compress:[u'none', u'zlib@openssh.com'] server compress:[u'none', u'zlib@openssh.com'] client lang:[u''] server lang:[u''] kex follows?False
DEB [20160517-10:48:54.890] thr=1   paramiko.transport: Kex agreed: diffie-hellman-group1-sha1
DEB [20160517-10:48:54.890] thr=1   paramiko.transport: Cipher agreed: aes128-ctr
DEB [20160517-10:48:54.890] thr=1   paramiko.transport: MAC agreed: hmac-sha2-256
DEB [20160517-10:48:54.891] thr=1   paramiko.transport: Compression agreed: none
ERR [20160517-10:48:55.333] thr=1   paramiko.transport: Unknown exception: dlopen(/Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/bindings/_openssl.so, 2): Symbol not found: _BIO_new_CMS
  Referenced from: /Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/bindings/_openssl.so
  Expected in: flat namespace
 in /Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/bindings/_openssl.so
ERR [20160517-10:48:55.336] thr=1   paramiko.transport: Traceback (most recent call last):
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:   File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 1757, in run
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:     self.kex_engine.parse_next(ptype, m)
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:   File "/Library/Python/2.7/site-packages/paramiko/kex_group1.py", line 75, in parse_next
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:     return self._parse_kexdh_reply(m)
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:   File "/Library/Python/2.7/site-packages/paramiko/kex_group1.py", line 111, in _parse_kexdh_reply
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:     self.transport._verify_key(host_key, sig)
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:   File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 1602, in _verify_key
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:     key = self._key_info[self.host_key_type](Message(host_key))
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:   File "/Library/Python/2.7/site-packages/paramiko/rsakey.py", line 58, in __init__
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:     ).public_key(default_backend())
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:   File "/Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/backends/__init__.py", line 35, in default_backend
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:     _default_backend = MultiBackend(_available_backends())
ERR [20160517-10:48:55.336] thr=1   paramiko.transport:   File "/Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/backends/__init__.py", line 22, in _available_backends
ERR [20160517-10:48:55.337] thr=1   paramiko.transport:     "cryptography.backends"
ERR [20160517-10:48:55.337] thr=1   paramiko.transport:   File "build/bdist.macosx-10.11-intel/egg/pkg_resources/__init__.py", line 2235, in resolve
ERR [20160517-10:48:55.337] thr=1   paramiko.transport:     module = __import__(self.module_name, fromlist=['__name__'], level=0)
ERR [20160517-10:48:55.337] thr=1   paramiko.transport:   File "/Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module>
ERR [20160517-10:48:55.337] thr=1   paramiko.transport:     from cryptography.hazmat.backends.openssl.backend import backend
ERR [20160517-10:48:55.337] thr=1   paramiko.transport:   File "/Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/backends/openssl/backend.py", line 45, in <module>
ERR [20160517-10:48:55.337] thr=1   paramiko.transport:     from cryptography.hazmat.bindings._openssl import ffi as _ffi
ERR [20160517-10:48:55.337] thr=1   paramiko.transport: ImportError: dlopen(/Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/bindings/_openssl.so, 2): Symbol not found: _BIO_new_CMS
ERR [20160517-10:48:55.337] thr=1   paramiko.transport:   Referenced from: /Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/bindings/_openssl.so
ERR [20160517-10:48:55.337] thr=1   paramiko.transport:   Expected in: flat namespace
ERR [20160517-10:48:55.337] thr=1   paramiko.transport:  in /Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/bindings/_openssl.so
ERR [20160517-10:48:55.337] thr=1   paramiko.transport:

【问题讨论】:

  • 这里是这个命令 load_system_host_keys() 中的错误
  • 抛出此错误 ImportError: dlopen(/Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/bindings/ _openssl.so,2):未找到符号:_BIO_new_CMS 引用自:/Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/bindings/ _openssl.so 预期在:/Library/Python/2.7/site-packages/cryptography-1.3.2-py2.7-macosx-10.11-intel.egg/cryptography/hazmat/bindings/_openssl.so 中的平面命名空间

标签: python macos openssl cryptography paramiko


【解决方案1】:

brew 安装 openssl

brew 链接 openssl --force

xcode-select --install

export EXTRA_CFLAGS=-I/usr/local/opt/openssl/include && export EXTRA_CXXFLAGS=-I/usr/local/opt/openssl/include & export EXTRA_LDFLAGS=-L/usr/local/opt/openssl/lib

【讨论】:

  • openssl 已经安装并链接 brew install openssl 警告:openssl-1.0.2h_1 already installed ,执行导出命令后同样的错误
  • pyenv 安装 2.7.10; pyenv --版本; brew info openssl,别忘了之前做 xcode-select -install。
  • 其实我在这里找到了答案stackoverflow.com/questions/33462779/…谢谢你的回复
猜你喜欢
  • 2016-06-25
  • 2018-02-28
  • 2016-12-15
  • 1970-01-01
  • 2017-01-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-19
相关资源
最近更新 更多