我尝试在Mac OSX上安装h5py并使用它的群组和数据集功能,但我遇到了问题。在其安装网页上,它表示初学者在Mac上使用它的最简单方法是安装Anaconda,这是我所做的,因为我仍然认为自己是一个没有经验的程序员。无论如何,在安装Anaconda并在iPython Notebook中输入以下脚本后,我得到一个"未找到图像错误。"
import h5py
import numpy as np
f = h5py.File("mytestfile.hdf5" , "w")
这是完整的错误(非常长):
ImportError Traceback (most recent call last)
<ipython-input-1-65d72c32bd56> in <module>()
----> 1 import h5py
2 import numpy as np
3
4 f = h5py.File("mytestfile.hdf5", "w")
/Users/wlentzii/anaconda/lib/python2.7/site-packages/h5py/__init__.py in <module>()
21 _errors.silence_errors()
22
---> 23 from . import _conv
24 _conv.register_converters()
25
h5py/h5t.pxd in init h5py._conv (-------src-dir--------/h5py/_conv.c:6961)()
h5py/numpy.pxd in init h5py.h5t (-------src-dir--------/h5py/h5t.c:19623)()
/Users/wlentzii/Library/Enthought/Canopy_64bit/User/lib/python2.7/site- packages/numpy/__init__.pyc in <module>()
166 return loader(*packages, **options)
167
--> 168 from . import add_newdocs
169 __all__ = ['add_newdocs', 'ModuleDeprecationWarning']
170
/Users/wlentzii/Library/Enthought/Canopy_64bit/User/lib/python2.7/site- packages/numpy/add_newdocs.py in <module>()
11 from __future__ import division, absolute_import, print_function
12
---> 13 from numpy.lib import add_newdoc
14
15 ###############################################################################
/Users/wlentzii/Library/Enthought/Canopy_64bit/User/lib/python2.7/site- packages/numpy/lib/__init__.py in <module>()
16
17 from . import scimath as emath
---> 18 from .polynomial import *
19 #import convertcode
20 from .utils import *
/Users/wlentzii/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/lib/polynomial.py in <module>()
17 from numpy.lib.function_base import trim_zeros, sort_complex
18 from numpy.lib.type_check import iscomplex, real, imag
---> 19 from numpy.linalg import eigvals, lstsq, inv
20
21 class RankWarning(UserWarning):
/Users/wlentzii/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/linalg/__init__.py in <module>()
48 from .info import __doc__
49
---> 50 from .linalg import *
51
52 from numpy.testing import Tester
/Users/wlentzii/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/linalg/linalg.py in <module>()
27 )
28 from numpy.lib import triu, asfarray
---> 29 from numpy.linalg import lapack_lite, _umath_linalg
30 from numpy.matrixlib.defmatrix import matrix_power
31 from numpy.compat import asbytes
ImportError: dlopen(/Users/wlentzii/Library/Enthought/Canopy_64bit/User/lib /python2.7/site-packages/numpy/linalg/lapack_lite.so, 2): Library not loaded: @rpath/lib/libmkl_intel_lp64.dylib
Referenced from: /Users/wlentzii/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/linalg/lapack_lite.so
Reason: image not found
答案 0 :(得分:0)
你的追溯表明你使用的是Canopy的Python,而不是Anaconda的。要么(1)确保Anaconda出现在Canopy之前的系统路径中,要么(2)使用Canopy的包管理器来安装h5py。由于您已经安装了Canopy,并且已经在您的路径中首先出现,这可能是您最简单的选择。您可以使用图形包管理器(可从欢迎屏幕访问)或从命令行安装h5py
enpkg h5py