torch版本 1.10.2+cu102
torchvision版本 0.11.3+cu102
运行报错:UserWarning: Failed to load image Python extension: Could not find module 'C:\Users\****\AppData\Local\Programs\Python\Python39\Lib\site-packages\torchvision\image.pyd' (or one of its dependencies). Try using the full path with constructor syntax.
warn(f"Failed to load image Python extension: {e}")
搜索百度,都说版本有问题,怎么可能,都是些废话。
解决办法:
pyd文件其实就是一个dll文件,错误说的很清楚了,缺少依赖。用Dependency Walker查看一下依赖的DLL,发现需要这些:
C10.DLL
C10_CUDA.DLL
CUDART64_102.DLL
LIBPNG16.DLL
NVJPEG64_10.DLL
TORCH_CPU.DLL
除了NVJPEG64_10.DLL是CUDA的,其它都是Torch的,那肯定是NVJPEG64_10.DLL路径有问题了。最简的拷贝一份过来,问题解决。