2012-10-25 87 views
6

下面是我在嘗試在Mac OSX上安裝PyTable時遇到的詳細錯誤消息。`pip安裝表格失敗並顯示ERROR ::無法找到本地HDF5安裝

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安裝?

回答

6

因爲我使用的MacPorts,與已安裝的hdf5-18,這是在我的〜/ .bash_profile文件中指定

export HDF5_DIR=/opt/local 

,並打開一個新標籤(例如終端),使這些簡單的HDF5_DIR環境變量可用。

在我的新/刷新終端實例中,pip install tables將正確編譯並鏈接到我的hdf5庫(通過macports安裝)。好極了!

+0

在我的情況下,我用anaconda安裝hdf5,爲了在虛擬環境中安裝'tables',必須'export HDF5_DIR = $ HOME/anaconda3 /' – maxbellec