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

nik*_*hai 48 python hdf5 pandas

import pandas as pd
dfs = pd.HDFStore('xxxxx.h5')
Run Code Online (Sandbox Code Playgroud)

抛出此错误:

"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..."
Run Code Online (Sandbox Code Playgroud)

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

lin*_*bug 43

只需更新pytables:

pip install --upgrade tables
Run Code Online (Sandbox Code Playgroud)

为我工作.


Tha*_*ara 25

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

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

conda install -c conda-forge pytables
Run Code Online (Sandbox Code Playgroud)

请参阅以下屏幕截图.

在此输入图像描述

  • conda安装pytables为我解决了这个问题. (3认同)

Tar*_*rik 16

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

sudo apt-get install python3-tables
Run Code Online (Sandbox Code Playgroud)

请注意,我使用的是Python 3

  • 或者只是`pip install tables` for python 3 (10认同)
  • @shadi 阅读这篇文章:http://matthew-brett.github.io/pydagogue/installing_on_debian.html。它有一个平衡的观点,解释了 apt-get 与 pip 的优缺点。出于稳定性原因,我更喜欢使用 apt-get,其他人更喜欢 pip 以获得其他好处,例如更好地控制他们想要的包。将 virtualenv 与 pip 结合使用似乎也更可取。 (2认同)

SED*_*dji 6

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

python -m pip安装表

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