在使用 pip install -r requirements.txt 安装依赖项时,可能会遇到以下错误:

WARNING: Ignoring invalid distribution -ip (d:\anaconda\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\anaconda\lib\site-packages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pyminifier~=2.1
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/2c/8a/946b0b43e0912c907aba42507073675c2e4a4a836c5b1ce10be6f12575d0/pyminifier-2.1.tar.gz (47 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      Python 3.X support requires the 2to3 tool.
      It normally comes with Python 3.X but (apparenty) not on your distribution.
      Please find out what package you need to get 2to3and install it.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: Ignoring invalid distribution -ip (d:\anaconda\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\anaconda\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\anaconda\lib\site-packages)

根据错误信息,可能是缺少 2to3 工具导致的问题。尝试使用以下命令安装 2to3 工具:

sudo apt-get install python3-distutils

然后再次尝试安装依赖项:

pip install -r requirements.txt

如果仍然无法解决问题,请检查您的 Python 环境是否完整,并尝试重新安装 Python 或更新您的系统包。

pip install -r requirements.txt 错误:'Python 3.X support requires the 2to3 tool.'

原文地址: https://www.cveoy.top/t/topic/lyTm 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录