使用 pip install 下载需求时出错(设置命令:use_2to3 无效。)

新手上路,请多包涵

版本 pip 21.2.4 python 3.6

命令:

 pip install -r  requirements.txt

我的 requirements.txt 的内容:

 mongoengine==0.19.1
numpy==1.16.2
pylint
pandas==1.1.5
fawkes

命令失败并出现此错误

ERROR: Command errored out with exit status 1:
     command: /Users/*/Desktop/ml/*/venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/setup.py'"'"'; __file__='"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-pip-egg-info-97994d6e
         cwd: /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/
    Complete output (1 lines):
    error in mongoengine setup command: use_2to3 is invalid.
    ----------------------------------------
WARNING: Discarding https://*/pypi/packages/mongoengine-0.19.1.tar.gz#md5=68e613009f6466239158821a102ac084 (from https://*/pypi/simple/mongoengine/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mongoengine==0.19.1 (from versions: 0.15.0, 0.19.1)
ERROR: No matching distribution found for mongoengine==0.19.1

原文由 vamsi 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.9k
2 个回答

看起来 setuptools>=58 打破了对 use_2to3 的支持:

v58 的设置工具更改日志

因此,您应该将 setuptools 更新为 setuptools<58 或避免在设置参数中使用带有 use_2to3 的软件包。

我遇到了同样的问题, pip==19.3.1

原文由 nnseva 发布,翻译遵循 CC BY-SA 4.0 许可协议

我安装了 setuptools==58 它对我有用。 pip install setuptools==58 。来自之前在我的设备上运行的 setuptools==69 的错误。最后为这个错误保存了 setuptools 版本 58。

原文由 Md Jewele Islam 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题