皮普six.add_metaclass错误(Pip six.add_metaclass error)

2019-11-04 20:10发布

前几天,我开始使用PIP时(1,2或3)安装收到下面的错误。

*

Traceback (most recent call last):   File "/home/c4pta1n/.local/bin/pip", line 7, in <module>
    from pip._internal import main   File "/home/c4pta1n/.local/lib/python2.7/site-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions   File "/home/c4pta1n/.local/lib/python2.7/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (   File "/home/c4pta1n/.local/lib/python2.7/site-packages/pip/_internal/index.py", line 15, in <module>
    from pip._vendor import html5lib, requests, six   File "/home/c4pta1n/.local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py", line 86, in <module>
    from pip._vendor.urllib3.contrib import pyopenssl   File "/home/c4pta1n/.local/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL   File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL   File "/usr/local/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 13, in <module>
    from cryptography.hazmat.primitives.asymmetric import dsa, rsa   File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/primitives/asymmetric/__init__.py", line 12, in <module>
    @six.add_metaclass(abc.ABCMeta) AttributeError: 'module' object has no attribute 'add_metaclass'

*

pip3 install pip --ignore-installed six
Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 11, in <module>
    load_entry_point('pip==10.0.1', 'console_scripts', 'pip3')()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 476, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2700, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2318, in load
    return self.resolve()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2324, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 15, in <module>
    from pip._vendor import html5lib, requests, six
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 86, in <module>
    from pip._vendor.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 13, in <module>
    from cryptography.hazmat.primitives.asymmetric import dsa, rsa
  File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/primitives/asymmetric/__init__.py", line 12, in <module>
    @six.add_metaclass(abc.ABCMeta)
AttributeError: 'module' object has no attribute 'add_metaclass'

我一直在研究并试图解决这个问题,我一直没能缩小问题的范围。 只是之前注意到这个问题,我已经更新使用标准库我的Debian系统,也没有注意到的问题,我也更新使用PIP 3安装--update几个点子模块,我相信我已经更新模块是Scapy的,并要求我我无法使用PIP对于我曾尝试任何命令,甚至“PIP列表”或者通过3.6个点的任何版本。 我已经卸载并重新安装PIP,virtualenv中,并试图手动从我的distutils文件夹中删除six.add_metaclass-1.0 *文件夹。 没有什么我试图创造,我可以看到任何改变,我无法缩小范围,我看到写任何问题确实相似或与此相关的具体问题。 我希望能找到帮助下进一步缩小这个问题,纠正或者,可以帮助我的任何信息的方向指出。

Answer 1:

6 1.3.0没有add_metaclass 。 它被发布在2013年的一年。 真正的时间进行升级。



Answer 2:

我找到了答案,我的问题。 显然,一些Linux版本,即必须通过发行包管理器直接以工作PIP安装的特定版本和六。 有一些细微的变化在Debian中如何利用PIP的,特别是关于更新,他们已经在编码到他们的包管理这些变化,而不是点子。 当我重新编译的Python我已经卸载了整个Python框架,我去了源URL的重组Python和下载PIP和任何其他依赖。 我想既然我是直接从源代码安装,这将是罚款...如果你正在使用的CentOS,Debian的,红帽或者其他人,那么你就必须由你的发行版,以避免管理的包管理器安装PIP运行到这个错误的地方下了线。



文章来源: Pip six.add_metaclass error