今天在配置pytorch环境,参考这位大佬的方法https://blog.csdn.net/weixin_45527999/article/details/124571570
只不过在pytorch官网选择安装的code之后出现了如下报错
(pytorch) C:\Users\wjnde>conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
Collecting package metadata (current_repodata.json): failed
CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.
Exception: HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /pytorch/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
尝试了文中所说的更改.condarc方法,好像和我的不匹配,还是出现报错如下:
(pytorch) C:\Users\wjnde>conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
Collecting package metadata (current_repodata.json): failed
UnavailableInvalidChannel: HTTP 404 NOT FOUND for channel nvidia <http://mirrors.tuna.tsinghua.edu.cn/anaconda/nvidia>
The channel is not accessible or is invalid.
You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state,
and use `conda config --show-sources` to view config file locations.
于是尝试了直接删除.condarc,没用,十分不建议
然后找到了一段更换清华源的代码,打开.condarc文件把原本内容删掉改为如下就可以:
channels:
- defaults
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
show_channel_urls: True
需要注意一定要再次运行conda config --show-sources,确认配置文件内容已经修改
然后就完美解决,安装成功
如果还是有问题的话建议参考一下下面这位博主的方法
https://blog.csdn.net/weixin_46034990/article/details/128685668