7

这是我尝试在 Mac OSX 上安装 PyTables 时收到的详细错误消息。

calvin$ pip install tables
Downloading/unpacking tables
  Downloading tables-2.4.0.tar.gz (8.9MB): 8.9MB downloaded
  Running setup.py egg_info for package tables
    /var/folders/kl/_52jng9s6sl2knv_0jds9w140000gn/T/H5close2zXB1J.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
    main (int argc, char **argv) {
    ^~~~
    /var/folders/kl/_52jng9s6sl2knv_0jds9w140000gn/T/H5close2zXB1J.c:2:5: warning: implicit declaration of function 'H5close' is invalid in C99 [-Wimplicit-function-declaration]
        H5close();
        ^
    2 warnings generated.
    ld: library not found for -lhdf5
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    * Found numpy 1.6.2 package installed.
    * Found numexpr 2.0.1 package installed.
    * Found Cython 0.17.1 package installed.
    ld: library not found for -lhdf5
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    .. 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:
    /var/folders/kl/_52jng9s6sl2knv_0jds9w140000gn/T/H5close2zXB1J.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]

main (int argc, char **argv) {

^~~~

/var/folders/kl/_52jng9s6sl2knv_0jds9w140000gn/T/H5close2zXB1J.c:2:5: warning: implicit declaration of function 'H5close' is invalid in C99 [-Wimplicit-function-declaration]

    H5close();

    ^

2 warnings generated.

ld: library not found for -lhdf5

clang: error: linker command failed with exit code 1 (use -v to see invocation)

* Found numpy 1.6.2 package installed.

* Found numexpr 2.0.1 package installed.

* Found Cython 0.17.1 package installed.

ld: library not found for -lhdf5

clang: error: linker command failed with exit code 1 (use -v to see invocation)

.. 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.

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /Users/calvin/.virtualenvs/pythontrg/build/tables
Storing complete log in /Users/calvin/.pip/pip.log

我的 hdf5-18 库是通过 macports 安装的。他们可以在这里找到 -

calvin$ port content hdf5-18
Port hdf5-18 contains:
  /opt/local/bin/gif2h5
  /opt/local/bin/h52gif
  /opt/local/bin/h5c++
  /opt/local/bin/h5cc
  /opt/local/bin/h5copy
  /opt/local/bin/h5debug
  /opt/local/bin/h5diff
  /opt/local/bin/h5dump
  /opt/local/bin/h5import
  /opt/local/bin/h5jam
  /opt/local/bin/h5ls
  /opt/local/bin/h5mkgrp
  /opt/local/bin/h5perf_serial
  /opt/local/bin/h5redeploy
  /opt/local/bin/h5repack
  /opt/local/bin/h5repart
  /opt/local/bin/h5stat
  /opt/local/bin/h5unjam
  /opt/local/include/H5ACpublic.h
  /opt/local/include/H5AbstractDs.h
  /opt/local/include/H5Apublic.h
  /opt/local/include/H5ArrayType.h
  /opt/local/include/H5AtomType.h
  /opt/local/include/H5Attribute.h
  /opt/local/include/H5Classes.h
  /opt/local/include/H5CommonFG.h
  /opt/local/include/H5CompType.h
  /opt/local/include/H5Cpp.h
  /opt/local/include/H5CppDoc.h
  /opt/local/include/H5Cpublic.h
  /opt/local/include/H5DSpublic.h
  /opt/local/include/H5DataSet.h
  /opt/local/include/H5DataSpace.h
  /opt/local/include/H5DataType.h
  /opt/local/include/H5DcreatProp.h
  /opt/local/include/H5Dpublic.h
  /opt/local/include/H5DxferProp.h
  /opt/local/include/H5EnumType.h
  /opt/local/include/H5Epubgen.h
  /opt/local/include/H5Epublic.h
  /opt/local/include/H5Exception.h
  /opt/local/include/H5FDcore.h
  /opt/local/include/H5FDdirect.h
  /opt/local/include/H5FDfamily.h
  /opt/local/include/H5FDlog.h
  /opt/local/include/H5FDmpi.h
  /opt/local/include/H5FDmpio.h
  /opt/local/include/H5FDmpiposix.h
  /opt/local/include/H5FDmulti.h
  /opt/local/include/H5FDpublic.h
  /opt/local/include/H5FDsec2.h
  /opt/local/include/H5FDstdio.h
  /opt/local/include/H5FaccProp.h
  /opt/local/include/H5FcreatProp.h
  /opt/local/include/H5File.h
  /opt/local/include/H5FloatType.h
  /opt/local/include/H5Fpublic.h
  /opt/local/include/H5Gpublic.h
  /opt/local/include/H5Group.h
  /opt/local/include/H5IMpublic.h
  /opt/local/include/H5IdComponent.h
  /opt/local/include/H5Include.h
  /opt/local/include/H5IntType.h
  /opt/local/include/H5Ipublic.h
  /opt/local/include/H5LTpublic.h
  /opt/local/include/H5Library.h
  /opt/local/include/H5Lpublic.h
  /opt/local/include/H5MMpublic.h
  /opt/local/include/H5Object.h
  /opt/local/include/H5Opublic.h
  /opt/local/include/H5PTpublic.h
  /opt/local/include/H5PacketTable.h
  /opt/local/include/H5Ppublic.h
  /opt/local/include/H5PredType.h
  /opt/local/include/H5PropList.h
  /opt/local/include/H5Rpublic.h
  /opt/local/include/H5Spublic.h
  /opt/local/include/H5StrType.h
  /opt/local/include/H5TBpublic.h
  /opt/local/include/H5Tpublic.h
  /opt/local/include/H5VarLenType.h
  /opt/local/include/H5Zpublic.h
  /opt/local/include/H5api_adpt.h
  /opt/local/include/H5overflow.h
  /opt/local/include/H5pubconf.h
  /opt/local/include/H5public.h
  /opt/local/include/H5version.h
  /opt/local/include/hdf5.h
  /opt/local/include/hdf5_hl.h
  /opt/local/lib/libhdf5.7.dylib
  /opt/local/lib/libhdf5.a
  /opt/local/lib/libhdf5.dylib
  /opt/local/lib/libhdf5.la
  /opt/local/lib/libhdf5.settings
  /opt/local/lib/libhdf5_cpp.7.dylib
  /opt/local/lib/libhdf5_cpp.a
  /opt/local/lib/libhdf5_cpp.dylib
  /opt/local/lib/libhdf5_cpp.la
  /opt/local/lib/libhdf5_hl.7.dylib
  /opt/local/lib/libhdf5_hl.a
  /opt/local/lib/libhdf5_hl.dylib
  /opt/local/lib/libhdf5_hl.la
  /opt/local/lib/libhdf5_hl_cpp.7.dylib
  /opt/local/lib/libhdf5_hl_cpp.a
  /opt/local/lib/libhdf5_hl_cpp.dylib
  /opt/local/lib/libhdf5_hl_cpp.la
  /opt/local/share/hdf5_examples/README
  /opt/local/share/hdf5_examples/c++/chunks.cpp
  /opt/local/share/hdf5_examples/c++/compound.cpp
  /opt/local/share/hdf5_examples/c++/create.cpp
  /opt/local/share/hdf5_examples/c++/extend_ds.cpp
  /opt/local/share/hdf5_examples/c++/h5group.cpp
  /opt/local/share/hdf5_examples/c++/readdata.cpp
  /opt/local/share/hdf5_examples/c++/run-c++-ex.sh
  /opt/local/share/hdf5_examples/c++/writedata.cpp
  /opt/local/share/hdf5_examples/c/h5_attribute.c
  /opt/local/share/hdf5_examples/c/h5_chunk_read.c
  /opt/local/share/hdf5_examples/c/h5_compound.c
  /opt/local/share/hdf5_examples/c/h5_drivers.c
  /opt/local/share/hdf5_examples/c/h5_elink_unix2win.c
  /opt/local/share/hdf5_examples/c/h5_extend_write.c
  /opt/local/share/hdf5_examples/c/h5_extlink.c
  /opt/local/share/hdf5_examples/c/h5_group.c
  /opt/local/share/hdf5_examples/c/h5_mount.c
  /opt/local/share/hdf5_examples/c/h5_read.c
  /opt/local/share/hdf5_examples/c/h5_ref2reg.c
  /opt/local/share/hdf5_examples/c/h5_reference.c
  /opt/local/share/hdf5_examples/c/h5_select.c
  /opt/local/share/hdf5_examples/c/h5_shared_mesg.c
  /opt/local/share/hdf5_examples/c/h5_write.c
  /opt/local/share/hdf5_examples/c/ph5example.c
  /opt/local/share/hdf5_examples/c/run-c-ex.sh
  /opt/local/share/hdf5_examples/hl/c++/ptExampleFL.cpp
  /opt/local/share/hdf5_examples/hl/c++/ptExampleVL.cpp
  /opt/local/share/hdf5_examples/hl/c++/run-hlc++-ex.sh
  /opt/local/share/hdf5_examples/hl/c/ex_ds1.c
  /opt/local/share/hdf5_examples/hl/c/ex_image1.c
  /opt/local/share/hdf5_examples/hl/c/ex_image2.c
  /opt/local/share/hdf5_examples/hl/c/ex_lite1.c
  /opt/local/share/hdf5_examples/hl/c/ex_lite2.c
  /opt/local/share/hdf5_examples/hl/c/ex_lite3.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_01.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_02.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_03.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_04.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_05.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_06.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_07.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_08.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_09.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_10.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_11.c
  /opt/local/share/hdf5_examples/hl/c/ex_table_12.c
  /opt/local/share/hdf5_examples/hl/c/image24pixel.txt
  /opt/local/share/hdf5_examples/hl/c/image8.txt
  /opt/local/share/hdf5_examples/hl/c/pal_rgb.h
  /opt/local/share/hdf5_examples/hl/c/ptExampleFL.c
  /opt/local/share/hdf5_examples/hl/c/ptExampleVL.c
  /opt/local/share/hdf5_examples/hl/c/run-hlc-ex.sh
  /opt/local/share/hdf5_examples/hl/run-hl-ex.sh
  /opt/local/share/hdf5_examples/run-all-ex.sh

如何让我pip install tables知道在哪里寻找我的 hdf5 安装?

4

2 回答 2

6

因为我使用的是 macports,并且已经安装了 hdf5-18,所以就像指定一样简单

export HDF5_DIR=/opt/local

在我的 ~/.bash_profile 文件中并打开一个新选项卡(终端实例),以便此 HDF5_DIR 环境变量可用。

在我的新/刷新终端实例中,pip install tables将正确编译并链接到我的 hdf5 库(通过 macports 安装)。耶!

于 2012-10-25T07:35:27.483 回答
0

我也面临同样的问题。然而,在一个新的 conda 环境中,我可以简单地安装它

conda install -c conda-forge pytables.

我想知道如何在包的 setup.cfg 文件中指定这一点。

于 2021-08-27T14:37:19.793 回答