pytables安装失败

问题描述 投票:1回答:4

我做:

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。

install pip hdf5
4个回答
8
投票

我也在Debian sid尝试在本地virtualenv工作时遇到了同样的错误。为了解决这个问题,我做了:

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

......现在它正在发挥作用。


1
投票

我能够使用以下代码在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帖子)


0
投票

我遇到了类似的问题,但是我使用的是前沿而不是pip版本(参见Aside)。我也尝试过指向图书馆本身

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

但它不起作用。

旁白:如果您认为最近可能已经解决了您的错误,您可以尝试PyTables的前沿:

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

.

在我安装了hdf5库的开发版本(libhdf5-openmpi-dev)之后,构建(由pip install引起的......)似乎进一步发展。由于其他原因,构建仍然失败,但这是您可以尝试的另一个方向。


0
投票

我尝试了一切都没有成功。我能实现的唯一方法就是使用nehalecky的答案:

https://github.com/PyTables/PyTables/issues/219

简而言之,您应该执行以下两个命令,更正路径,当然:

sudo python3 setup.py build_ext --inplace --hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial/
sudo python3 setup.py install --hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial/

希望能帮助到你!

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