vscode安装库总是错误,已崩溃
原代码为pip install torch>=1.12.0 torchvision>=0.13.0 swanlab>=0.3.3 gradio
报错为
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/torch/
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/torch/
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/torch/
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/torch/
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/torch/
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch 安装报错解决方案:
这个SSL错误通常由网络问题或Python版本不兼容导致,可以尝试以下方法:
[*]更换国内镜像源
pip install torch>=1.12.0 torchvision>=0.13.0 swanlab>=0.3.3 gradio -i https://pypi.tuna.tsinghua.edu.cn/simple
[*]关闭SSL验证(临时方案)
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org 包名
[*]检查Python版本
PyTorch 1.12+需要:
Python >=3.7
在终端输入:
python --version
[*]使用官方推荐命令安装PyTorch
访问官网获取最新命令:
https://pytorch.org/get-started/locally/
例如:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
补充说明:
1. 如果使用公司/学校网络,可能需要配置代理
2. 建议先升级pip:
python -m pip install --upgrade pip
3. Windows用户推荐使用Anaconda环境安装PyTorch
如果问题仍未解决,请提供以下信息:
[*]操作系统版本
[*]Python版本
[*]是否使用虚拟环境
[*]完整的报错日志
以上回复来自 FishC AI 小助理,如未能正确解答您的问题,请继续追问。 网络不好,命令可以改成pip install torch>=1.12.0 torchvision>=0.13.0 swanlab>=0.3.3 gradio -i https://mirrors.aliyun.com/pypi/simple
页:
[1]