Possible Duplicate:
Installing h5py on OS Xh5py安裝
後給出的錯誤,我試圖讓h5py在我的OS X獅子10.7.3的MacBook Pro工作。它已經工作過,但不知何故它已卸載,我不能再安裝它。它似乎與安裝XCode 4.3有關,但我不確定。
當導入h5py,我得到以下錯誤:
>>> import h5py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/h5py/__init__.py", line 1, in <module>
from h5py import _errors
ImportError: dlopen(/Library/Python/2.7/site-packages/h5py/_errors.so, 2): Symbol not found: _H5E_ALREADYEXISTS_g
Referenced from: /Library/Python/2.7/site-packages/h5py/_errors.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/h5py/_errors.so
我想這事做與HDF5庫。它還沒有安裝,所以我安裝它首先使用
brew install hdf5
這沒有給出任何錯誤。但最後的警告如下。我的猜測是很重要的:
ld: warning: ignoring file ../hdf5-1.8.8/hdf5/lib/libhdf5.a,
file was built for archive which is not the architecture being linked (i386)
我不是100%肯定這是什麼意思,但我想這個庫被編譯爲i386架構,不過有此目錄中多個文件不抱怨:
libhdf5.la
libhdf5.dylib -> libhdf5.7.dylib
libhdf5.7.dylib
libhdf5.settings
libhdf5.a
libhdf5_hl.la
libhdf5_hl.dylib -> libhdf5_hl.7.dylib
libhdf5_hl.a
libhdf5_hl.7.dylib
後來我也自己編譯了源碼,從HDF5組網站(http://www.hdfgroup.org/HDF5/)下載。使用下面的配置線,以確保它使共享庫我加--enable-共享和殘疾人FORTRAN:
./configure --with-zlib=/usr/local --disable-fortran
--prefix=/usr/local/ --target=x86_64-apple-darwin
-build=x86_64-apple-darwin --host=x86_64-apple-darwin
--enable-shared --disable-production
我同時取出h5py和HDF5庫並重新安裝他們幾次(包括編譯h5py自己,因爲使用pip和easy_install),但這似乎沒有幫助。
我也裝h5py使用我只是用這個命令所做的構建:
python setup.py build --hdf5=../hdf5-1.8.8/hdf5
我也更新了我的numpy的和SciPy的安裝到最新版本。