【发布时间】:2013-03-06 08:42:17
【问题描述】:
我对 Python 非常陌生,我正在尝试使用 HDFStore 在 pandas 中创建一个表,如下所示
store = HDFStore('store.h5')
我得到了例外:
Exception Traceback (most recent call last)
C:\Python27\<ipython-input-11-de3060b689e6> in <module>()
----> 1 store = HDFStore('store.h5')
C:\Python27\lib\site-packages\pandas-0.10.1-py2.7-win32.egg\pandas\io\pytables.pyc in __init__(self, path, mode, complevel, complib, fletcher32)
196 import tables as _
197 except ImportError: # pragma: no cover
--> 198 raise Exception('HDFStore requires PyTables')
199
200 self.path = path
Exception: HDFStore requires PyTables
我已经安装了 Pytables,它存在于站点包中。 pandas(0.l0.1) 和 pytables(2.4.0) 都是 32 位 Windows 版本。 32 位 Windows 的 Python 版本为 2.7.3
我正在使用 ipython notebook 运行它。
我忘了补充说我有 Windows 7 - 64 位操作系统,但 Python 及其所有相关插件都是 32 位的。
【问题讨论】:
-
如果你运行
import tables会发生什么? -
引发导入错误:
ImportError Traceback (most recent call last) C:\Python27\<ipython-input-12-389ecae14f10> in <module>() ----> 1 import tables C:\Python27\lib\site-packages\tables\__init__.py in <module>() 67 68 # Necessary imports to get versions stored on the cython extension ---> 69 from tables.utilsExtension import getPyTablesVersion, getHDF5Version 70 71 ImportError: cannot import name getPyTablesVersion -
我忘了补充说我有 Windows 7 - 64 位操作系统,但是 Python 和所有相关的附加组件都是 32 位的,这可能是个问题吗?
-
我不这么认为。你是如何安装 pytables 的?你确定一切都编译了吗?您可以尝试使用其中一个设置文件from here。
-
谢谢,我回过头来发现我没有正确编译它,因为我没有安装HDF5库。