可能重复:
我试图让h5py在我的OSXLion10.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 5库有关。它还没有安装,所以我首先使用
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)我不能百分之百确定这意味着什么,但我想这个库是为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/)下载。使用以下配置行,确保它使我添加的共享库--启用共享和禁用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安装到最新版本。
发布于 2012-03-26 14:25:59
从Mac的干净安装来看,我要做的是:
使用命令行工具安装Xcode (xcode-select ...)
然后我就可以:
$ brew install hdf5它没有正确链接,因为我的/usr/local/lib是不可写的。检查brew doctor,看看是否有任何未链接的包:
$ brew doctor
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built.
hdf5
szip所以我把dir写成可以用
$ brew link hdf5
$ brew link szip那我就可以
$ sudo pip install h5py还有预告片。
>>> import h5py
>>> https://stackoverflow.com/questions/9873427
复制相似问题