解决pip install -r requirements.txt 出现'error: subprocess-exited-with-error' 错误
在使用 pip install -r requirements.txt 安装依赖时,你可能会遇到以下错误:
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
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2c/8a/946b0b43e0912c907aba42507073675c2e4a4a836c5b1ce10be6f12575d0/pyminifier-2.1.tar.gz (47 kB)
---------------------------------------- 47.3/47.3 kB 474.9 kB/s eta 0:00:00
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:
pip install 2to3
然后再运行
pip install -r requirements.txt
如果还是出现同样的错误,可以尝试升级 pip 或者手动安装 pyminifier。
原文地址: https://www.cveoy.top/t/topic/lyTe 著作权归作者所有。请勿转载和采集!