一、找到合适的安装方式
pytorch官网:https://pytorch.org/
二、安装命令
pip3 install torch torchvision -i https://pypi.mirrors.ustc.edu.cn/simple
后面的是镜像,当然也可以采用其他源,网上很多;
国内镜像源列表
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
报错说明:
1. 报错
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='mirrors.tuna.tsinghua.edu.cn', port=443): Read timed out.
增加 --default-timeout=1000
命令修改为:
pip3 install --default-timeout=100