点六.add_metaclass错误 [英] Pip six.add_metaclass error

查看:128
本文介绍了点六.add_metaclass错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天前,使用pip(1、2或3)进行安装时,我开始出现以下错误.

A few days ago I started getting the following error when using pip (1,2 or 3) to install.

*

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系统,没有任何注意事项,我还使用pip3 install --update更新了一些pip模块,我相信我更新的模块是scapy和requests 我无法对尝试过的任何命令使用pip,甚至无法使用"pip list"或3.6版之前的任何版本的pip. 我已经卸载并重新安装了pip,virtualenv,并尝试从distutils文件夹中手动删除six.add_metaclass-1.0 *文件夹. 我尝试过的所有操作都没有产生任何可见的变化,也无法缩小我看到的有关此问题的确与之相似或相关的任何问题. 我希望能找到帮助,以进一步缩小该问题的范围,更正该问题,或指出任何可能对我有帮助的信息.

I have been researching and trying to troubleshoot this issue and I have not been able to narrow down the issue. Just prior to noticing this issue I had updated my debian system using the standard repository and had no issues of note, I had also updated a few pip modules using pip3 install --update, I believe the modules I had updated were scapy and requests I am unable to use pip for any command that I have tried, even "pip list" or any version of pip through 3.6. I have uninstalled and reinstalled pip, virtualenv, and tried to manually remove the six.add_metaclass-1.0* folder from my distutils folder. Nothing I have tried has created any change that I can see and I am not able to narrow down that any issue that I see written about is indeed similar or related to this specific issue. I am hoping to find help to narrow this problem down further, correct it or be pointed in the direction of any information that could help me.

推荐答案

我找到了问题的答案.显然,某些linux版本具有pip的特定版本,并且必须通过发行版软件包管理器直接安装六个版本才能正常工作. Debian使用pip的方式有一些细微的变化,尤其是在更新方面,他们已经将这些更改编码到了程序包管理器中而不是pip中.当我重新编译Python时,我已经卸载了整个python框架,然后转到源URL重新编译python并下载pip和任何其他依赖项.我认为,因为我直接从源代码进行安装就可以了...如果您使用的是CentOS,Debian,Redhat以及其他,则必须从发行版管理的软件包管理器中安装pip,以避免在某个地方遇到这个错误.

I found the answer to my issue. Apparently some linux versions have specific versions of pip and six that have to be installed through the distro package manager directly in order to work. There are some nuanced changes in how Debian makes use of pip, especially regarding updates, and they have coded these changes in to their package manager and not to pip. When I recompiled Python I had uninstalled the entire python framework and I went to the source url's to recombine python and to download pip and any other dependencies. I figured since I was installing directly from the source that it would be fine... If you are using CentOS, Debian,Redhat and maybe others, then you must install pip from the package manager that is managed by your distro in order to avoid running into this error somewhere down the line.

这篇关于点六.add_metaclass错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆