ImportError HDFStore需要PyTables没有名为tables的模块

问题描述 投票:41回答:7
import pandas as pd
dfs = pd.HDFStore('xxxxx.h5')

抛出此错误:

"ImportError: HDFStore requires PyTables, "No module named tables" problem importing"

我试图安装PyTables,需要Cython。我安装了Cython 0.21,但它抛出了一个错误,说明Cython应该大于0.13

这是我得到的日志:

".. ERROR:: You need Cython 0.13 or greater to compile PyTables!

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/tmp/pip_build_root/tables
Storing debug log for failure in /Users/nikhilsahai/Library/Logs/pip.log
Nikhils-MacBook-Pro:~ nikhilsahai$ sudo pip install cython
Requirement already satisfied (use --upgrade to upgrade): cython in /Library/Python/2.7/site-packages/Cython-0.21-py2.7-macosx-10.9-intel.egg
Cleaning up..."

请指导我如何解决这个问题。

python pandas hdf5
7个回答
36
投票

只需更新pytables

pip install --upgrade tables

为我工作。


23
投票

使用HDFStore时我也遇到了同样的错误。我尝试了上面指定的所有步骤并花了很多时间来寻找解决方案,但没有成功。

然后我下载并安装了MiniConda。然后我使用下面的命令来安装pytables。

conda install -c conda-forge pytables

请参阅以下屏幕截图。

enter image description here


16
投票

在Ubuntu上,我使用以下命令解决了这个问题:

sudo apt-get install python3-tables

请注意,我使用的是Python 3


6
投票

你可以在任何操作系统上使用pip:

python -m pip安装表

您可以查看有关安装它的更多方法的官方文档http://www.pytables.org/usersguide/installation.html


2
投票

正如TomAugspurger所提到的......似乎最新版本的pytables存在一个错误。您可以通过执行以下命令来安装当前的开发版本:

sudo pip install git+https://github.com/PyTables/PyTables

如果它解决了问题,那么问题应该关闭:)


2
投票

你必须安装pytables:

conda install pytables


1
投票

在Windows上,使用此命令可能是一个不错的选择:

pip安装表-3.2.2-cp34-cp34m-win_amd64.whl

---您可以从http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy下载的文档

© www.soinside.com 2019 - 2024. All rights reserved.