【问题标题】:python pip3 has attribute error when installing flask for python 3.4.3python pip3在为python 3.4.3安装flask时出现属性错误
【发布时间】:2020-08-31 21:54:08
【问题描述】:

我将 3.4.3 用于学校项目,但 pip 似乎不喜欢这样。我在虚拟机中工作。 当我 pip3 install flask 时出现此错误。

Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_vagrant/MarkupSafe

还有这个:

 class DistutilsLoader(importlib.util.abc.Loader):
 AttributeError: 'module' object has no attribute 'abc'

我检查了一下,最初我在 /usr/lib/python3.4 中没有 dist-packages 目录,但我在 /usr/lib/python3/ 中有一个现有的 dist-packages,所以我从 /usr/lib 创建了一个符号链接/python3.4 到现有的 dist 包。不太确定还能做什么,除了重新安装 Python 或更糟糕的虚拟机...我正在研究 pip.log 但它似乎与我已经看到的非常相似。

【问题讨论】:

  • 查看今天的问题:github.com/pypa/setuptools/issues/2362。也许您刚刚升级了setuptools?尝试降级它。试试pip install --upgrade "setuptools<44"
  • 谢谢,这与其他答案能够在我的系统上安装烧瓶。 @phd

标签: python pip


【解决方案1】:

Python 3.4.3 is pretty ancient and no longer supported。实际上,仍然不支持任何版本的 Python 3.4。我强烈建议升级到 Python 的现代版本,最好是 3.8。

当前版本的 Flask requires Python 2.7 or Python 3.5+

如果您绝对必须继续使用 Python 3.4,请尝试安装 version 1.0.4,它似乎是支持 Python 3.4 的最新版本:

pip3 install flask==1.0.4

【讨论】:

  • 是的,我在学校项目中坚持使用 3,4,3 :( 感谢您的回答,并提供了 setuptools 降级提示,这让我能够使用 python3 安装正确的烧瓶。你摇滚!
  • @derric-d,很高兴为您提供帮助。但是博士的评论可能就足够了。通常,我认为pip 会自行找到正确的版本,遵守 Python 版本限制。
猜你喜欢
  • 1970-01-01
  • 2022-12-11
  • 1970-01-01
  • 1970-01-01
  • 2014-08-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多