清华源安装Pytorch报错解决。

在尝试使用清华源通过Conda安装Pytorch时遇到'CondaHTTPError: HTTP 000 CONNECTION FAILED'错误。参考某博客提供的解决方案,更新conda配置文件后,环境配置成功,但下载速度较慢。
摘要由CSDN通过智能技术生成

“CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/current_repodata.json

用清华源安装Pytorch报错解决。

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda install pytorch torchvision cudatoolkit=10.0

上面的方法来自:
(https://blog.csdn.net/zzq060143/article/details/88042075)
一直报错:“CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/curre

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
要使用清华源安装PyTorch,可以按照以下步骤进行操作: 1. 打开终端,并输入以下命令来安装PyTorch: ``` pip --trusted-host pypi.tuna.tsinghua.edu.cn install torch==1.10.1+cu102 torchvision==0.11.2+cu102 torchaudio==0.10.1 -f https://download.pytorch.org/whl/torch_stable.html ``` 这个命令会将清华源作为pip的信任主机,并从清华源下载PyTorch安装包进行安装。\[1\] 2. 安装完成后,可以在虚拟环境的终端中输入`python`进入Python环境,然后输入`import torch`并回车。如果没有报错,说明PyTorch已经成功安装。你可以使用`print(torch.__version__)`来查看PyTorch的版本,使用`print(torch.cuda.is_available())`来查看是否支持GPU加速,使用`print(torch.cuda.device_count())`来查看GPU的数量,使用`print(os.cpu_count())`来查看CPU的数量。\[2\] 3. 如果需要卸载已安装PyTorch,可以使用以下命令: ``` pip uninstall torch pip uninstall torchvision pip uninstall torchaudio ``` 这些命令将卸载相应的PyTorch组件。\[2\] 请注意,如果你使用conda来管理Python环境,可以使用以下命令来安装PyTorch: ``` conda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cudatoolkit=10.2 ``` 这个命令会从清华镜像源获取文件进行安装。\[3\] #### 引用[.reference_title] - *1* [pip换清华源一步搞定pytorch在cuda上运行(非常快!)](https://blog.csdn.net/chenyuhaokaixin/article/details/127143164)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [Anaconda使用清华源安装不同版本的Pytorch](https://blog.csdn.net/qq_53273581/article/details/123624718)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值