直接 pip install torch -i https://pypi.tuna.tsinghua.edu.cn/simple
Building wheel for torch (setup.py) ... error
ERROR: Failed building wheel for torch
失败
pip install --upgrade torch torchvision -i https://pypi.tuna.tsinghua.edu.cn/simple
还是失败
ERROR: torchvision 0.5.0 has requirement torch==1.4.0, but you'll have torch 0.1.2.post2 which is incompatible.
再次尝试
pip install --upgrade torch==1.4.0 torchvision==0.5.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
但是还是安装失败
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
ERROR: Could not find a version that satisfies the requirement torch==1.4.0 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.4.0
最后找到一种新的方式:
https://pytorch.org/get-started/locally/
最后安装成功(还得看网速,在另一台笔记本上面就是超时了),注意是使用 pip install,而不是 conda install(安装失败)
pip install torch==1.4.0+cpu torchvision==0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html