安装:
1:直接conda install pytorch-cpu -c pytorch
结果:网络超时报错
2:把下载源转化到清华镜像
https://blog.youkuaiyun.com/watermelon1123/article/details/88122020
conda install pytorch-cpu pytorch
结果:仍然下载报错,网络超时
3:去清华软件园直接下载安装包,网址如下:
https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/
conda install 路径\压缩包
结果:成功
测试:
import torch
torch.__version__
输出:'1.2.0'
配置 Jupyter Notebook
新建的环境是没有安装安装ipykernel的所以无法注册到Jupyter Notebook中,所以先要准备下环境
激活到conda的pytorch环境下
#安装ipykernel
conda install ipykernel
#写入环境
windows:python -m ipykernel install --name pytorch --display-name "Pytorch for Deeplearning" #第一个name是conda中的虚拟环境名,第二个name是在jypyter notebook中显示的环境名称
linux:python -m ipykernel install --name pytorch --user --display-name "Pytorch for Deeplearning"