解决 pip install -r requirements.txt 报错: Could not find a version that satisfies the requirement pyminifier~=2.1
在使用 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)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)'))': /simple/pyminifier/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)'))': /simple/pyminifier/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)'))': /simple/pyminifier/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)'))': /simple/pyminifier/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)'))': /simple/pyminifier/
Could not fetch URL https://pypi.org/simple/pyminifier/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pyminifier/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)'))) - skipping
ERROR: Could not find a version that satisfies the requirement pyminifier~=2.1 (from versions: none)
ERROR: No matching distribution found for pyminifier~=2.1
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)
这个错误可能是由于网络连接或 SSL 证书问题导致的。你可以尝试以下步骤来解决问题:
- 确保你的网络连接正常,并且可以访问 https://pypi.org/ 网站。
- 尝试升级 pip 工具: 在命令行中执行
pip install --upgrade pip。 - 尝试直接安装 pyminifier 库: 使用以下命令安装 pyminifier 库:
pip install pyminifier.
如果以上步骤不起作用,请尝试使用 pip 的 --trusted-host 选项来忽略 SSL 证书问题。例如:
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pyminifier
通过这些步骤,你应该能够成功解决问题并安装所需的库。
原文地址: https://www.cveoy.top/t/topic/lySs 著作权归作者所有。请勿转载和采集!