网站源码带后台,人才网官方网站,番禺建设局网站,营销网站设计方案Windows下Conda安装pytorch换源
我们直接从conda官方或pytorch官方安装pytorch时#xff0c;由于服务器在国外#xff0c;速度很慢#xff0c;或者无法下载/中断#xff0c;这时候换上国内的镜像源会快很多。
这里给出更换阿里源的例子#xff0c;其他国内源同理。
配置…Windows下Conda安装pytorch换源
我们直接从conda官方或pytorch官方安装pytorch时由于服务器在国外速度很慢或者无法下载/中断这时候换上国内的镜像源会快很多。
这里给出更换阿里源的例子其他国内源同理。
配置方法
创建.condarc文件
Windows 用户无法直接创建名为 .condarc 的文件可先执行 conda config --set show_channel_urls yes 生成该文件之后再修改。
该文件所在路径通常为C盘/User/用户名/.condarc
配置镜像源
用以下内容替换.condarc文件内容
channels:- defaults
show_channel_urls: true
default_channels:- https://mirrors.aliyun.com/anaconda/pkgs/main- https://mirrors.aliyun.com/anaconda/pkgs/r- https://mirrors.aliyun.com/anaconda/pkgs/msys2
custom_channels:conda-forge: https://mirrors.aliyun.com/anaconda/cloudmsys2: https://mirrors.aliyun.com/anaconda/cloudbioconda: https://mirrors.aliyun.com/anaconda/cloudmenpo: https://mirrors.aliyun.com/anaconda/cloudpytorch: https://mirrors.aliyun.com/anaconda/cloudsimpleitk: https://mirrors.aliyun.com/anaconda/cloud
注意这里网上的其他教程一般是 http但是可能不好使改成https就行了。
清除索引缓存
配置完成可运行命令 conda clean -i 清除索引缓存。
使用方式
在下载时如果不指定特定通道则会使用上述的默认通道去检索包。
当要指定特定通道时在conda install xxx后面加上例如-c conda-forge指定使用conda-forge通道这样的参数即可。
我们可以通过打开上述默认通道的路径去查看是否存在需要的包举个例子打开https://mirrors.aliyun.com/anaconda/cloud/
依次点击pytorch-win64我们会发现存在例如pytorch-1.10.0-py3.9_cuda11.3_cudnn8_0.tar.bz2这样的链接名意即python3.9的pytorch1.10.0-cuda11.3且这个channel的pytorch1.10.0-gpu支持python3.63.73.83.9这时候如果用python3.10去拉这个环境是拉不下来的。