如何安装支持hdf4的macos catalina(python)的gdal

2024-05-14 03:47:26 发布

您现在位置:Python中文网/ 问答频道 /正文

有人能推荐一种在macos catalina上安装支持hdf4的gdal的简单方法吗

我已经尝试了很多方法,但我仍然无法阅读hdf4

  1. 我通过带有this指令的自制程序安装了gdal。显然地 gdal不支持hdf4
  2. 我尝试使用sudo port install gdal +hdf4 +hdf5 +netcdf通过Macports安装gdal,正如前面的thread建议的那样,但是 安装失败,出现以下错误:

    Error: Failed to build gdal: command execution failed Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gis_gdal/gdal/main.log for details. Error: Follow https://guide.macports.org/#project.tickets to report a bug. Error: Processing of port gdal failed ---> Some of the ports you installed have notes: netcdf has the following notes: As of version 4.2 c++ and fortran interfaces are separate ports, netcdf-cxx and netcdf-fortran, respectively.

  3. 我试着为上述错误寻找解决方案,但没有找到与我匹配的。所以我放弃了gdal

  4. 我继续安装pyhdf和pymodis,但都失败了。Pyhdf错误为:未能生成Pyhdf 错误:无法为使用PEP 517且无法直接安装的pyhdf生成控制盘。对于pymodis,它是成功的,但显然通过brew安装的GDAL I不支持HDF4(错误:GDAL安装不支持HDF4,请更新GDAL) WxPython缺失,未启用GUI)

任何帮助都会很好


Tags: ofto方法portlocal错误netcdferror
1条回答
网友
1楼 · 发布于 2024-05-14 03:47:26

我好几天都在努力寻找答案。我也放弃了gdal方法,转而安装pyhdf,但从源代码构建要复杂得多。我最初避免使用anaconda,因为我更喜欢使用virtualenv来管理虚拟环境,但要启动并运行pyhdf,最简单的方法是:

  1. 安装Python
  2. 创建新的虚拟环境
  3. 在mac终端窗口中激活该新环境
  4. 运行conda install -c conda-forge pyhdf

您将不得不重新安装所有其他必需的软件包,这可能会很痛苦,但比从源代码构建选项更快。Testye

相关问题 更多 >