pytorch安装记事本

cpu版(极速):

D:\anaconda3\envs\env_name\Scripts\pip.exe install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 -i https://pypi.tuna.tsinghua.edu.cn/simple

PyTorch

【工程实践】pytorch加速下载(conda与pip)_pytorch清华源下载-CSDN博客

使用pip install替代conda install将packet下载到anaconda虚拟环境_用pip下载了怎么改成用conda下载-CSDN博客

卸载装gpu版:

torch.cuda.is_available()返回false——解决办法_cuda available false-CSDN博客

### 如何通过国内 Conda 镜像源安装或更新 PyTorch 为了提高下载速度并减少因网络问题导致的失败,可以通过配置国内镜像源来安装或更新 PyTorch。 #### 修改 `.condarc` 文件以使用清华大学镜像源 对于 Windows 用户,在记事本中打开 `C:\Users\<用户名>\.condarc` 并添加如下内容: ```yaml channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ ssl_verify: true show_channel_urls: true ``` 此文件指定了多个渠道用于软件包检索,并启用了 SSL 验证和显示渠道 URL 的选项[^1]。 #### 添加上海交通大学镜像作为额外的选择 除了上述方法外,还可以利用命令行工具向现有频道列表追加来自上海交通大学的镜像地址: ```bash conda config --add channels https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main/ conda config --add channels https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.sjtug.sjtu.edu.cn/anaconda/cloud/conda-forge/ ``` 这些命令将指定的镜像站加入到用户的默认搜索路径之中[^2]。 #### 安装 PyTorch 软件包而不依赖官方通道 当准备就绪之后,执行下面这条简化过的安装语句即可完成 PyTorch 及其依赖项的部署工作;注意这里去掉了 `-c pytorch` 参数部分,使得整个流程能够顺利调用之前设置好的本地化资源库: ```bash conda install pytorch torchvision torchaudio cudatoolkit=11.3 ``` 该命令假设读者希望获取 CUDA 版本为 11.3 的 PyTorch 发布版本。如果不需要 GPU 支持,则可省略 `cudatoolkit=<version>` 这一部分[^4]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

七月是你的谎言..

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值