2014-02-06 284 views
1

我做的:pytables安裝失敗

sudo pip install --upgrade tables 

我得到:

/usr/bin/ld: cannot find -lhdf5 
collect2: ld returned 1 exit status 
.. ERROR:: Could not find a local HDF5 installation. 
    You may need to explicitly state where your local HDF5 headers and 
    library can be found by setting the ``HDF5_DIR`` environment 
    variable or by using the ``--hdf5`` command-line option. 
Complete output from command python setup.py egg_info: 
/usr/bin/ld: cannot find -lhdf5 

但是:

$ echo $HDF5_DIR 
/opt/hdf5/ 
$ ls /opt/hdf5/ 
bin include lib share 
$ ls /opt/hdf5/lib/ 
libhdf5.a  libhdf5_hl.la libhdf5_hl.so.8  libhdf5.la  libhdf5.so libhdf5.so.8.0.1 
libhdf5_hl.a libhdf5_hl.so libhdf5_hl.so.8.0.1 libhdf5.settings libhdf5.so.8 

有什麼不對?如何調試?我已經嘗試將HDF5_DIR設置爲/ opt /或/ opt/hdf5/lib。

回答

0

我有類似的問題,但我使用領先優勢而不是點子釋放(見旁白)。 我也試過指着庫本身

export HDF5_DIR=/usr/lib/libhdf5.so.6 

但它沒有工作。

旁白:您可以嘗試PyTables的領先優勢,如果你認爲你的錯誤可能最近已解決:

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

在我安裝hdf5庫(libhdf5-openmpi-dev)的開發版本後,構建(這是由pip安裝引起的)似乎進一步發展。由於其他原因,構建仍然失敗,但這是您可以嘗試的另一個方向。

+2

'HDF5_DIR'需要一個目錄而不是一個文件,' export HDF5_DIR =/local/johndoe/hdf5' – minerals

7

我也在Debian sid上嘗試在本地virtualenv中工作時出現同樣的錯誤。要解決它,我做了:

apt-get build-dep python-tables 
HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/serial/ pip install tables 

...現在它的工作。

+1

'sudo apt-get build-dep python-tables'對我來說已經足夠了! (Ubuntu 14.04) – emmagras

+1

我所要做的只是'sudo apt-get install hdf5-serial-dev',然後是'pip install tables'。 –

+0

自2014年以來,很多內容已經發生變化,很高興知道-dev包現在可以用於pytables了:) – csirac2

2

我能夠在OSX使用下面的代碼虛擬環境中輕鬆解決這個問題:

$ brew install hdf5 
    $ pyvenv test 
    $ workon myvenv # to get pytables working within the virtual environment myvenv 
    $ pip install numpy numexpr cython 
    $ pip install tables 

(在https://github.com/PyTables/PyTables/issues/385從andreabedini後取)