问题
I am very new to Python and am trying to create a table in pandas with HDFStore as follows
store = HDFStore('store.h5')
I get the exception :
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
I already have Pytables installed and it is present in site-packages. Both pandas(0.l0.1) and pytables(2.4.0) are 32 bit Windows versions. Python version is 2.7.3 for 32 bit windows
I am running this using ipython notebook.
I forgot to add that I have Windows 7 - 64 bit OS, but Python and all its related add-ons are 32 bit.
回答1:
I also had the same error when using HDFStore. And I tried all the steps specified above and spent many hours to find a solution, but non of them were successful.
Then I downloaded and installed MiniConda. And then I used the below command to install pytables.
conda install -c conda-forge pytables
Please refer the below screenshot.
回答2:
I suspect your problem is that you have not added Python Scripts to your system PATH
. Assuming that check out this tutorial on how to do it.
You are looking to add the C:\Python27, C:\Python27\Lib. and C:\Python27\Scripts
. Make sure you separate each one with a ;
. Also make sure you add it to your system PATH
variable and not just your user PATH
variable.
after all of that check import pytables
. It should no longer throw and error, because python will be 'know' that pytables is installed and be able to locate it.
回答3:
I had same problem. I am using win7 + anaconda python2.7 + IPython.
But I fixed it with following steps:
From http://www.lfd.uci.edu/~gohlke/pythonlibs/#pytables
download file tables‑3.2.1‑cp27‑none‑win_amd64.whl
and install it with cmd
pip install tables‑3.2.1‑cp27‑none‑win_amd64.whl
after installed problem solved.
ref: http://www.pytables.org/usersguide/installation.html#binary-installation-windows
来源:https://stackoverflow.com/questions/15469594/exception-hdfstore-requires-pytables-when-using-hdf5-file-in-ipython