首页 > 解决方案 > pytables 的 DLL 加载失败

问题描述

运行包含 pytables 的代码时出现以下错误:

Traceback (most recent call last):
File "C:\Users\pierr\python354\lib\site-packages\pandas\io\pytables.py", line 469, in __init__
import tables  # noqa
File "C:\Users\pierr\python354\lib\site-packages\tables\__init__.py", line 90, in <module>
from .utilsextension import (
ImportError: DLL load failed: The specified procedure could not be found.

...
 File "C:\Users\pierr\python354\lib\site-packages\pandas\io\pytables.py", line 472, in __init__
'importing'.format(ex=str(ex)))
ImportError: HDFStore requires PyTables, "DLL load failed: The specified procedure could not be found." problem importing

python 版本 3.5.4 | 表版本 3.4.2 | 窗户 10

标签: python-3.xpytableshdfstore

解决方案


我有一个类似的问题。当我尝试运行以下代码时:

import pandas as pd
df = pd.read_hdf('some.hdf')

我收到一个错误:

ImportError: Missing optional dependency 'tables'.  Use pip or conda to install tables.

即使pytables模块是使用 conda 和 pip 安装的(最后当然是 as tables),错误仍然存​​在。import tables也没有工作:

from .utilsextension import (
ImportError: DLL load failed: Не найден указанный модуль.

"Не найден указанный модуль"俄语中的意思"The specified module was not found"
我爬进了 Traceback 中最后一个模块所在的文件夹 - '~\AppData\Roaming\Python\Lib\site-packages\tables' 并找到utilsextension.cp37-win_amd64.pyd了在那里命名的文件。然后我下载Dependency Walker了实用程序并查看了这个文件。程序说找不到pytables_hdf5.dll。我在文件夹中找到了这个文件,~\AppData\Roaming\Python\Lib\site-packages\tables\并通过以下方式将其添加到 PATH 变量中:

os.environ['PATH'] += os.pathsep + os.path.expanduser('~\\AppData\\Roaming\\Python\\Lib\\site-packages\\tables')

之后一切正常,import tables不再pd.read_hdf返回错误。希望这对某人有用。


推荐阅读