anaconda安装清华镜像源pytorch-cpu
时间: 2023-11-07 13:55:02 浏览: 62
好的,以下是在anaconda中安装pytorch-cpu并使用清华镜像源的步骤:
1. 首先打开anaconda prompt
2. 输入以下命令创建一个名为pytorch的虚拟环境,并安装pytorch-cpu
```
conda create -n pytorch python=3.7
conda activate pytorch
conda install pytorch-cpu torchvision-cpu -c pytorch -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
```
3. 安装完成后,可以输入以下命令验证是否安装成功
```
python
import torch
print(torch.__version__)
```
如果输出了pytorch的版本号,则说明安装成功。
希望这个回答能够帮助到你!
相关问题
anaconda清华镜像源安装torch
可以按照以下步骤设置清华镜像源并安装torch:
1. 打开Anaconda Navigator,点击左侧菜单栏中的“Environments”选项卡,选择要安装torch的环境。
2. 右键点击该环境,选择“Open Terminal”打开终端窗口。
3. 在终端窗口中输入以下命令,添加清华镜像源:
```
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 --set show_channel_urls yes
```
4. 输入以下命令更新conda:
```
conda update conda
```
5. 输入以下命令安装torch:
```
conda install pytorch torchvision torchaudio cpuonly
```
6. 如果需要安装GPU版本的torch,可以输入以下命令:
```
conda install pytorch torchvision torchaudio cudatoolkit=<Cuda版本号>
```
其中,<Cuda版本号>需要替换为你的电脑上安装的Cuda版本号。如果不知道Cuda版本号,可以在终端窗口中输入以下命令查看:
```
nvcc --version
```
查看完Cuda版本号后,再输入以上命令进行安装即可。
anaconda清华镜像源添加
要添加清华镜像源到Anaconda,可以使用以下命令:
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.***<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Anaconda 添加清华镜像源](https://blog.csdn.net/qq_33682559/article/details/110389091)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [Pytorch(cpu+Windows10+Anaconda(Python3.7)+Pycharm+Jupyter Notebook+清华镜像源) 环境搭建](https://download.csdn.net/download/weixin_38651812/13747015)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]