python - 使用 pytorch 时出现 DLL 文件错误
问题描述
我通过 pip 安装添加 pytorch,现在我正在尝试使用它,但是有这个 dll 错误:
Traceback (most recent call last):
File "F:/Python/Projects/1.py", line 2, in <module>
import torch
File "C:\Users\Saeed\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\__init__.py", line 78, in <module>
from torch._C import *
ImportError: DLL load failed: The specified module could not be found.
我安装了 msvcp71 和 msvcr71 dll 文件,但它不起作用!
解决方案
You can use Dependency Walker to find out which dependency of that DLL might be missing. Use it to open the Python extension file that's failing to load. The file name should be something like:
C:\Users\Saeed\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\_C.pyd
Another common cause is a DLL for Python 64-bit while using Python 32-bit or vice-versa. But you installed with pip
so it should be OK. Nevertheless, it's a good idea to verify this is not the case.
推荐阅读
- javascript - 我的滑块只显示第一个和第三个滑块,但不显示表格的第二个和第四个滑块
- java - 比较器被称为对象和接口
- angular - 在Angular 5中输出两个数字的NaN
- javascript - 比较 2 个对象数组是否匹配,无论其在 lodash 中的索引如何?
- electron - 如何从election.js 中获取当前正在运行的其他windows/mac 应用程序的信息?
- javascript - 隐藏内容后如何刷新div
- windows - 在 vs 代码和代码中。在命令提示符下无法在 Windows 中工作
- javascript - 预期 true 等于 false
- ios - UIView.animate 不能在 swift 中正常工作
- ios - 应用程序委托与视图控制器中的代码