【问题标题】:h5py errors after installation安装后h5py错误
【发布时间】:2015-10-19 20:12:55
【问题描述】:

我正在尝试在 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

【问题讨论】:

  • 如果已经有与此非常相似的问题,我深表歉意。我的问题是,由于我非常缺乏经验,我很难从类似的问题中推断出我自己的问题......
  • 看起来像 numpyenthought 的问题,而不是 h5py
  • 谢谢,这与安装 Anaconda 有关,因为这实际上发生在我安装之前已经运行的一些脚本上。我卸载了 Anaconda,现在 iPython 又可以正常工作了,我只需要正确弄清楚如何获取 h5py。我可能会尝试“非初学者”安装。

标签: python macos numpy enthought h5py


【解决方案1】:

您的回溯显示您使用的是 Canopy 的 Python,而不是 Anaconda 的。 (1) 确保 Anaconda 出现在 Canopy 之前的系统路径中,或者 (2) 使用 Canopy 的包管理器安装 h5py。由于您已经安装了 Canopy,并且它已经出现在您的路径中,这可能是您最简单的选择。您可以使用图形包管理器(可从欢迎屏幕访问)或从命令行安装 h5py

enpkg h5py

【讨论】:

  • 感谢您的回答,我最终使用 homebrew/science 来获取 h5py。
猜你喜欢
  • 2012-04-10
  • 2020-05-23
  • 1970-01-01
  • 1970-01-01
  • 2016-09-16
  • 2016-10-13
  • 1970-01-01
  • 2018-09-15
相关资源
最近更新 更多