安装
通过conda
conda install pytorch torchvision -c pytorch
通过pip
有gpu
pip install torch torchvision
也可以指定版本和pip源:
pip install torch==1.0.1 torchvision==0.2.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
无gpu
pip install torch==1.4.0+cpu torchvision==0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
(如果下载速度太慢,则复制下载地址到浏览器,获取下载链接,用迅雷把 .whl 下下来)