python 在macos中使用pip命令安装pyhdf时出错

dluptydi  于 2024-01-05  发布在  Python
关注(0)|答案(1)|浏览(188)

我试图在macos终端中使用pip命令安装pyhdf(https://pypi.org/project/pyhdf/)包,但我面临以下错误:

  1. Collecting pyhdf
  2. Using cached pyhdf-0.11.3.tar.gz (146 kB)
  3. Installing build dependencies ... done
  4. Getting requirements to build wheel ... done
  5. Installing backend dependencies ... done
  6. Preparing metadata (pyproject.toml) ... done
  7. Building wheels for collected packages: pyhdf
  8. Building wheel for pyhdf (pyproject.toml) ... error
  9. error: subprocess-exited-with-error
  10. × Building wheel for pyhdf (pyproject.toml) did not run successfully.
  11. exit code: 1
  12. ╰─> [38 lines of output]
  13. running bdist_wheel
  14. running build
  15. running build_py
  16. creating build
  17. creating build/lib.macosx-11.1-arm64-cpython-311
  18. creating build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  19. copying pyhdf/V.py -> build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  20. copying pyhdf/error.py -> build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  21. copying pyhdf/HDF.py -> build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  22. copying pyhdf/__init__.py -> build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  23. copying pyhdf/VS.py -> build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  24. copying pyhdf/six.py -> build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  25. copying pyhdf/SD.py -> build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  26. copying pyhdf/HC.py -> build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  27. copying pyhdf/hdfext.py -> build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  28. copying pyhdf/test_SD.py -> build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  29. running egg_info
  30. writing pyhdf.egg-info/PKG-INFO
  31. writing dependency_links to pyhdf.egg-info/dependency_links.txt
  32. writing top-level names to pyhdf.egg-info/top_level.txt
  33. reading manifest file 'pyhdf.egg-info/SOURCES.txt'
  34. reading manifest template 'MANIFEST.in'
  35. no previously-included directories found matching 'doc/_build'
  36. adding license file 'LICENSE'
  37. adding license file 'AUTHORS'
  38. writing manifest file 'pyhdf.egg-info/SOURCES.txt'
  39. copying pyhdf/hdfext.i -> build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  40. copying pyhdf/hdfext_wrap.c -> build/lib.macosx-11.1-arm64-cpython-311/pyhdf
  41. running build_ext
  42. building 'pyhdf._hdfext' extension
  43. creating build/temp.macosx-11.1-arm64-cpython-311
  44. creating build/temp.macosx-11.1-arm64-cpython-311/pyhdf
  45. clang -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/kamran/anaconda3/include -arch arm64 -fPIC -O2 -isystem /Users/kamran/anaconda3/include -arch arm64 -I/private/var/folders/dx/c0jyd4_j1952tqyy_9_6bg0h0000gn/T/pip-build-env-1wj7gp28/overlay/lib/python3.11/site-packages/numpy/core/include -I/Users/kamran/anaconda3/include/python3.11 -c pyhdf/hdfext_wrap.c -o build/temp.macosx-11.1-arm64-cpython-311/pyhdf/hdfext_wrap.o -DNOSZIP
  46. pyhdf/hdfext_wrap.c:3677:10: fatal error: 'hdf.h' file not found
  47. #include "hdf.h"
  48. ^~~~~~~
  49. 1 error generated.
  50. error: command '/usr/bin/clang' failed with exit code 1
  51. [end of output]
  52. note: This error originates from a subprocess, and is likely not a problem with pip.
  53. ERROR: Failed building wheel for pyhdf
  54. Failed to build pyhdf
  55. ERROR: Could not build wheels for pyhdf, which is required to install pyproject.toml-based projects

字符串
这个软件包很容易安装在windows和Linux中,但在macOS中不工作。有人能提供这个错误的解决方案吗?

ktecyv1j

ktecyv1j1#

您的系统上缺少hdf.h头文件,这些头文件是为pyhdf构建wheel的依赖项。
尝试brew install hdf5brew install hdf
pip install pyhdf又来了

相关问题