在anaconda prompt中用pip安装:
pip install torch1.5.0+cu101 torchvision0.6.0+cu101 -fhttps://download.pytorch.org/whl/torch_stable.html修改D:\anaconda3.5\lib\site-packages中_init_.py中79行为:dlls = glob.glob(os.path.join(“D:\anaconda3.5\lib\site-packages\torch\lib”,’*.dll’))
再去运行import torch
import torchvision成功就可以了
如果import torchvision报错module ‘torch’ has no attribute ‘_utils_internal’,则需要安装低版本:安装低版本torchvision:pip install -i https://pypi.tuna.tsinghua.edu.cn/simpletorchvision==0.4.1