python基本库six_Python-six库的导入问题

闾丘选
2023-12-01

在我的virtualenv中,我有很多库使用six作为依赖项,但是paramiko和python keystoneclient会引发这个导入错误:ERROR:paramiko.transport:Unknown exception: cannot import name urllib_parse

ERROR:paramiko.transport:Traceback (most recent call last):

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/paramiko/transport.py", line 1772, in run

ERROR:paramiko.transport: self.kex_engine.parse_next(ptype, m)

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/paramiko/kex_group1.py", line 75, in parse_next

ERROR:paramiko.transport: return self._parse_kexdh_reply(m)

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/paramiko/kex_group1.py", line 111, in _parse_kexdh_reply

ERROR:paramiko.transport: self.transport._verify_key(host_key, sig)

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/paramiko/transport.py", line 1617, in _verify_key

ERROR:paramiko.transport: key = self._key_info[self.host_key_type](Message(host_key))

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/paramiko/rsakey.py", line 58, in __init__

ERROR:paramiko.transport: ).public_key(default_backend())

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 35, in default_backend

ERROR:paramiko.transport: _default_backend = MultiBackend(_available_backends())

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 22, in _available_backends

ERROR:paramiko.transport: "cryptography.backends"

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/pkg_resources/__init__.py", line 2235, in resolve

ERROR:paramiko.transport: module = __import__(self.module_name, fromlist=['__name__'], level=0)

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/__init__.py", line 7, in

ERROR:paramiko.transport: from cryptography.hazmat.backends.openssl.backend import backend

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 15, in

ERROR:paramiko.transport: from cryptography import utils, x509

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/cryptography/x509/__init__.py", line 7, in

ERROR:paramiko.transport: from cryptography.x509.base import (

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/cryptography/x509/base.py", line 15, in

ERROR:paramiko.transport: from cryptography.x509.extensions import Extension, ExtensionType

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/cryptography/x509/extensions.py", line 22, in

ERROR:paramiko.transport: from cryptography.x509.general_name import GeneralName, IPAddress, OtherName

ERROR:paramiko.transport: File "/.../lib/python2.7/site-packages/cryptography/x509/general_name.py", line 15, in

ERROR:paramiko.transport: from six.moves import urllib_parse

ERROR:paramiko.transport:ImportError: cannot import name urllib_parse

我通过互联网找到了一种方法来解决这个问题而不需要解决它。在

我已经尝试了以下步骤:重新安装所有相关库

重新安装virtualenv

尝试了几个旧的六个版本

以下是库的版本:密码学==1.4

密钥验证1==2.8.0

参数==2.0.1

python密钥客户端==3.1.0

python swiftclient==3.0.0

六==1.10.0

urllib3==1.16

对于这些Python版本,我也遇到了同样的问题:Python 2.7.11+--gt;Ubuntu 16.04

Python 2.7.10-->Ubuntu 15.10

如果我尝试

^{pr2}$

在pythonshell中,它可以正常工作。在

你知道吗?提前谢谢!在

 类似资料: