![在 OS X 10.14.6(Mojave)上安装 h5py 时遇到问题](https://linux22.com/image/1603003/%E5%9C%A8%20OS%20X%2010.14.6%EF%BC%88Mojave%EF%BC%89%E4%B8%8A%E5%AE%89%E8%A3%85%20h5py%20%E6%97%B6%E9%81%87%E5%88%B0%E9%97%AE%E9%A2%98.png)
我正在尝试安装 H5py ( h5py
) HDF5 库的 Python 包装器 (https://pypi.org/project/h5py/) 在运行 OS X 10.14.6 (Mojave) 的 MacBook Air (2019 年中) 的虚拟环境中。Python 版本是 3.7.4。
作为参考,我使用了 H5py 构建说明页面https://h5py.readthedocs.io/en/stable/build.html。
根据h5py
MPICH 的要求 (http://www.mpich.org) 和 HDF5 (https://www.hdfgroup.org/solutions/hdf5/) 系统库,我通过 Brew 安装了这些库,然后h5py
使用 Git 存储库的分支进行了安装(https://github.com/h5py/h5py)。
这些是我按给定顺序执行的步骤。
1. brew install mpich && pip install mpi4py
2. brew install hdf5
3. git clone https://github.com/mygit/h5py
4. cd h5py && python setup.py configure --mpi
5. python setup.py configure --hdf5=/usr/local/Cellar/hdf5
6. pip setup.py install
h5py
最后一步(安装)似乎一切顺利。
...
Using /path/to/venv/lib/python3.7/site-packages
已完成 h5py==2.10.0 依赖项处理
$ pip freeze | grep h5py
h5py==2.10.0
但我无法h5py
在 Python 3 中导入。
In [1]: import h5py
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-c9f0b8c65221> in <module>
----> 1 import h5py
/path/to/venv/lib/python3.7/site-packages/h5py-2.10.0-py3.7-macosx-10.9-x86_64.egg/h5py/__init__.py in <module>
32 raise
33
---> 34 from . import version
35
36 if version.hdf5_version_tuple != version.hdf5_built_version_tuple:
/path/to/venv/lib/python3.7/site-packages/h5py-2.10.0-py3.7-macosx-10.9-x86_64.egg/h5py/version.py in <module>
15
16 from collections import namedtuple
---> 17 from . import h5 as _h5
18 import sys
19 import numpy
h5py/h5.pyx in init h5py.h5()
ImportError: dlopen(/path/to/venv/lib/python3.7/site-packages/h5py-2.10.0-py3.7-macosx-10.9-x86_64.egg/h5py/defs.cpython-37m-darwin.so, 2): Symbol not found: _H5Fget_mpi_atomicity
Referenced from: /path/to/venv/lib/python3.7/site-packages/h5py-2.10.0-py3.7-macosx-10.9-x86_64.egg/h5py/defs.cpython-37m-darwin.so
Expected in: flat namespace
in /path/to/venv/lib/python3.7/site-packages/h5py-2.10.0-py3.7-macosx-10.9-x86_64.egg/h5py/defs.cpython-37m-darwin.so
有人能解释一下这里的问题是什么吗?