官网下载Anaconda安装包,按步骤安装即可
安装完后,打开DOS,或Anaconda自带的Anaconda Prompt终端
查看Anaconda已安装的安装包
C:\Users\jiangshan>conda list
安装 matplotlib
C:\Users\jiangshan>conda install matplotlib
设置镜像
# 添加Anaconda的清华镜像
C:\Users\jiangshan>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
C:\Users\jiangshan>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
C:\Users\jiangshan>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
C:\Users\jiangshan>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
# 设置搜索时显示通道地址
C:\Users\jiangshan>conda config --set show_channel_urls yes
安装pytorch torchvision cudatoolkit
C:\Users\jiangshan>conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
想使用清华镜像
C:\Users\jiangshan>conda install pytorch torchvision cudatoolkit=10.0
注意以下信息
===========================================================================================================================
## Package Plan ##
environment location: S:\Users\jiangshan\Anaconda3
added / updated specs:
- cudatoolkit=10.0
- pytorch
- torchvision
The following packages will be downloaded:
package | build
---------------------------|-----------------
conda-4.6.8 | py37_0 897 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cudatoolkit-10.0.130 | 0 371.0 MB defaults
ninja-1.9.0 | h1ad3211_0 112 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pytorch-1.0.1 |py3.7_cuda100_cudnn7_1 464.9 MB pytorch
torchvision-0.2.2 | py_3 44 KB pytorch
------------------------------------------------------------
Total: 836.9 MB
The following NEW packages will be INSTALLED:
cudatoolkit pkgs/main/win-64::cudatoolkit-10.0.130-0
ninja anaconda/cloud/conda-forge/win-64::ninja-1.9.0-h1ad3211_0
pytorch pytorch/win-64::pytorch-1.0.1-py3.7_cuda100_cudnn7_1
torchvision pytorch/noarch::torchvision-0.2.2-py_3
The following packages will be SUPERSEDED by a higher-priority channel:
conda pkgs/main --> anaconda/cloud/conda-forge
==============================================================================================================================================
测试
C:\Users\jiangshan>conda -V
conda 4.6.8
C:\Users\jiangshan>python
Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.0.1'
安装完成

使用xshell只能查看python
$ python -V
Python 3.7.1

删除旧镜像源
C:\Users\jiangshan>conda config --show
C:\Users\jiangshan>conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/