Linux安装pytorch怎么加入镜像源
时间: 2023-11-03 10:53:15 浏览: 171
要在Linux上安装PyTorch并加入镜像源,可以按照以下步骤进行操作:
1. 打开终端,并执行以下命令来配置conda源:
```
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/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
```
2. 验证镜像源是否成功添加,执行以下命令:
```
conda config --show channels
```
如果输出的信息中包含以下内容,则表示镜像源已成功添加:
```
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- defaults
```
3. 现在可以创建一个虚拟环境并安装PyTorch了。执行以下命令:
```
conda create --name myenv
conda activate myenv
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1
```
这将创建一个名为"myenv"的虚拟环境,并安装指定版本的PyTorch和相关依赖。
通过以上步骤,您可以在Linux上成功安装PyTorch并加入镜像源。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* [Linux服务器安装pytorch更换conda清华镜像源](https://blog.csdn.net/xmhsq888888/article/details/125283896)[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^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [Linux 系统安装 Pytorch](https://blog.csdn.net/qq_46457076/article/details/129839473)[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^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [Linux下更换清华源安装pytorch](https://blog.csdn.net/weixin_43425556/article/details/127093160)[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^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文