鱼C论坛

 找回密码
 立即注册
查看: 25|回复: 1

vscode安装库总是错误,已崩溃

[复制链接]
发表于 16 小时前 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
原代码为
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
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 16 小时前 | 显示全部楼层
安装报错解决方案:

这个SSL错误通常由网络问题或Python版本不兼容导致,可以尝试以下方法:

  • 更换国内镜像源

    1. pip install torch>=1.12.0 torchvision>=0.13.0 swanlab>=0.3.3 gradio -i [url=https://pypi.tuna.tsinghua.edu.cn/simple]https://pypi.tuna.tsinghua.edu.cn/simple[/url]
    复制代码

  • 关闭SSL验证(临时方案)

    1. pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org 包名
    复制代码

  • 检查Python版本
    PyTorch 1.12+需要:
    Python >=3.7
    在终端输入:

    1. python --version
    复制代码

  • 使用官方推荐命令安装PyTorch
    访问官网获取最新命令:
    https://pytorch.org/get-started/locally/
    例如:

    1. pip3 install torch torchvision torchaudio --index-url [url=https://download.pytorch.org/whl/cu117]https://download.pytorch.org/whl/cu117[/url]
    复制代码



补充说明:
1. 如果使用公司/学校网络,可能需要配置代理
2. 建议先升级pip:

  1. python -m pip install --upgrade pip
复制代码

3. Windows用户推荐使用Anaconda环境安装PyTorch

如果问题仍未解决,请提供以下信息:
  • 操作系统版本
  • Python版本
  • 是否使用虚拟环境
  • 完整的报错日志


以上回复来自 FishC AI 小助理,如未能正确解答您的问题,请继续追问。
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-4-26 17:56

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表