首页 > 编程知识 正文

清华镜像源怎么用,清华开源软件镜像站

时间:2023-05-04 08:33:33 阅读:192347 作者:999

使用清华镜像源安装Pytorch

文章目录 使用清华镜像源安装Pytorch配置清华镜像源安装Pytorch在Linux上使用shell脚本一键安装

配置清华镜像源

我们使用Anaconda环境进行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/cloud/conda-forge conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/# 设置搜索时显示通道地址conda config --set show_channel_urls yes 安装Pytorch

使用清华镜像源进行Pytorch的安装时,官方给出的安装命令就失效了

官方给出的安装命令是:

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

如果使用清华镜像源安装Pytorch时,需要输入以下命令:

conda install pytorch torchvision cudatoolkit=10.1 在Linux上使用shell脚本一键安装

使用Linux系统的时候,有时一步一步复制粘贴命令非常麻烦,特别是使用远程服务器的时候。这时候就需要shell脚本一键解决复制粘贴命令的麻烦。

在任意文件目录下新建一个shell脚本文件,这里取名为 pytorch_install.sh

shell脚本文件的内容如下所示

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/# 设置搜索时显示通道地址conda config --set show_channel_urls yes# 安装pytorchconda install pytorch torchvision cudatoolkit=10.1

在命令行中执行shell脚本,输入命令:

bash pytorch_install.sh

等待安装完成即可。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。