终于解决了安装torch的同时cuda版本

两步解决conda安装pytorch时下载速度慢or超时的问题_anaconda下载pytorcg太慢-CSDN博客

pip安装包超时的几种解决办法 - 知乎 (zhihu.com)

谢谢你,超时侠!

困扰我整整一个周末的问题(详见上篇文章)

然后一定一定要避坑的是

# CUDA 11.7
pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2
# CUDA 11.8
pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118

前者是cpu版本的,要安装后者有cu118的!!!(要安装cu117可以把118改成117!)

但是尚不确定为什么最新的是用pip3 而旧的统一用pip(最新pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118)

也尚不确定为什么是这样的:

然后发现只要 一安装成功,后面再次

pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118 就不会超时了

神奇!

结果最新的安装成功了。再也不用加上–default-timeout=1000。

笔者还发现,如果channels只有defaults,当你输入pip install torch==2.0.1+cu118
依然会导致Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple然后报错

但是conda config --show 的结果:

channels:
  - defaults

default_channels:
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - https://repo.anaconda.com/pkgs/msys2

莫非系统会自动地识别我在中国所以用上了清华源!?(所以还是去官方下载吧)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值