问题:明明安装好pytorch,但加载失败,显示no module,无论是cmd-》python命令行还是jupyter都存在这个问题
解决方案:(网上有很多解决方案,试了好几种,记录一下适合自己环境并成功解决的方案)
1.卸载torch
pip uninstall torch
2.清华镜像重新安装torch
python -m pip install --upgrade torch torchvision -i https://pypi.tuna.tsinghua.edu.cn/simple
3.出现报错“[WinError 126] 找不到指定的模块”
显示Microsoft Visual C++ Redistributable is not installed, this may lead to the DLL load failure.It can be downloaded at https://aka.ms/vs/16/release/vc_redist.x64.exe.因为没有安装Visual C++的库导致的
按照报错提示链接下载Visual C++并安装即可。
(问题不同,大家给出的解决方案也有差异,可以多试试,实在不行,就重新来过。。。)