解决BUG:error: metadata-generation-failed

BUG说明:

执行命令:pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple 时报错,经分析未检测单setuptools-57.5.0

具体报错如下:

  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error in ConcurrentLogHandler setup command: use_2to3 is invalid.
      [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

解决方案:

在执行批量安装命令pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple之前,先执行pip install setuptools==57.5.0 -i https://pypi.tuna.tsinghua.edu.cn/simple 命令

成功解决:

Installing collected packages: xlwt, ConcurrentLogHandler, urllib3, idna, charset-normalizer, certifi, requests
Successfully installed ConcurrentLogHandler-0.9.1 certifi-2022.9.24 charset-normalizer-2.0.12 idna-3.4 requests-2.27.1 urllib3-1.26.13 xlwt-1.3.0