【问题标题】:Installing enum package causes pip to not work安装 enum 包导致 pip 无法工作
【发布时间】:2019-01-15 17:48:31
【问题描述】:

我使用pip (pip install pytodos) 安装了新版本的pytodos 软件包。它需要安装enum 包,所以它是自动安装的。发生这种情况后,每次尝试对pip 做任何事情,即安装或卸载任何软件包,都会导致此错误:

_ASN1_TYPE_TO_ENUM = dict((i.value, i) for i in _ASN1Type)
TypeError: 'type' object is not iterable

但是当我从~/.local/lib/python2.7/site-packages 中删除所有以“enum”开头的文件时:

cd ~/.local/lib/python2.7/site-packages
rm -rf enum*

...,我能够再次安装和卸载软件包。再次安装enum 包(pip install enum)后,一切都会重复。

这种行为的原因可能是什么?

【问题讨论】:

  • 那是python 2吗?
  • @ReblochonMasque,是的,这是 python2

标签: python-2.7 pip packages


【解决方案1】:

根据https://github.com/pyca/cryptography/issues/4020,您需要卸载enum 并安装enum34 或类似的代替。试试:

pip install --upgrade enum34

【讨论】:

  • 正如我刚才所说,安装enum 后,我无法安装,也无法卸载任何东西,包括enum。只有手动删除有帮助。不幸的是pytodos 需要enum。因此,每当我尝试安装 pytodos 时,它就会被安装。
  • 如果你都删除了,然后安装enum34,然后尝试安装pytodos怎么办?那仍然会自动安装enum吗?如果是这样,这整个事情就是一个打包错误,你需要自己构建pytodos
  • 删除 enum (rm -rf enum*) 后,卸载它 (pip uninstall enum) 会显示此消息 Skipping enum as it is not installed.。并尝试卸载 enum34 导致出现此消息:Cannot uninstall 'enum34'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.。但是当我运行pip install --upgrade enum34,然后安装pytodos它仍然需要enum并安装它,但进一步使用pip不再导致任何错误。
  • 我用过pip install cryptography==2.9
猜你喜欢
  • 2019-01-29
  • 1970-01-01
  • 1970-01-01
  • 2019-10-19
  • 2022-01-14
  • 2019-01-27
  • 1970-01-01
  • 1970-01-01
  • 2015-06-15
相关资源
最近更新 更多