Jupyter安装Pytorch遇到的问题(安装一直卡着、Could not fetch URL )及解决办法

我的安装路线是按照:https://blog.csdn.net/weixin_47038938/article/details/115470086 这篇博客进行的。

但在安装Pytorch这一步时:(我的cuda版本是:11.6)

conda install pytorch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0 pytorch-cuda=11.6 -c pytorch -c nvidia

Anaconda Prompt界面一直卡在:sovling environment 不动,也就是不继续安装下去,一卡可以卡几个小时,我一直挂着,以为只要时间够长,就一定可以安装下去,但是,是我想多了,一直卡着

于是我就尝试 Pip安装:
pip install torch==1.13.0+cu116 torchvision==0.14.0+cu116 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu116
结果出现:Could not fetch URL https://download.pytorch.org/whl/cu116/torch/: There was a problem confirming the ssl certificate: 
HTTPSConnectionPool(host='download.pytorch.org', port=443): Max retries exceeded with url: /whl/cu116/torch/
(Caused by SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))) - skipping

原因是:我当时挂着VPN。故,需要把VPN关了,将VPN彻底退出(原因了解处:https://blog.csdn.net/qq_40758284/article/details/114842247https://www.cnblogs.com/yinhaiping/p/13375375.html
重新:
pip install torch==1.13.0+cu116 torchvision==0.14.0+cu116 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu116
毫无疑问,这会比较慢,因为他是从 https://download.pytorch.org下载包的,它可能会出现timeout错误,也就是一些包只安装了一点,然后超时了;多重安装几次就好如果一直这样,可以重设延迟时间:pip --default-timeout=1000 install -U pip  (这里我设置为了1000)
其他步骤按照上面那篇博客的步骤进行,我安装Pytorch成功了
posted @ 2023-10-04 23:21  ZengZG  Views(505)  Comments(0Edit  收藏  举报