- Anaconda安装:略
- 查看Windows是否有NVIDIA显卡
如果有NVIDIA显卡的需要安装CUDA以获取GPU加速。以下是PyTorch官网的一句话
PyTorch can be installed and used on various Windows distributions. Depending on your system and compute requirements, your experience with PyTorch on Windows may vary in terms of processing time. It is recommended, but not required, that your Windows system has an NVIDIA GPU in order to harness the full power of PyTorch’s CUDA support.
-
访问PyTorch官网,获取安装命令(CUDA 选择 None)并安装
- 可以看到安装命令为:conda install pytorch torchvision torchaudio cpuonly -c pytorch,但是由于国内下载比较慢,安装前我们可以配置国内源:
# 配置国内源,方便安装Numpy,Matplotlib等 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/ # 配置国内源,安装PyTorch用 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ # 显示源地址 conda config --set show_channel_urls yes
- 要使用国内源,需要去掉-c pytorch,即cmd输入:conda install pytorch torchvision torchaudio cpuonly
- 可以看到安装命令为:conda install pytorch torchvision torchaudio cpuonly -c pytorch,但是由于国内下载比较慢,安装前我们可以配置国内源:
-
检查是否安装成功