简体   繁体   English

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

[英]how to install gdal with hdf4 support macos catalina (python)

Can anyone suggest a straightforward way to install gdal with hdf4 support on macos catalina?任何人都可以建议一种在 macos catalina 上安装支持 hdf4 的 gdal 的简单方法吗?

I have tried many ways and I am still not able to read hdf4.我尝试了很多方法,但我仍然无法读取 hdf4。

  1. I installed gdal via homebrew with this instruction.我使用指令通过自制软件安装了 gdal。 Apparently that gdal has no support for hdf4.显然 gdal 不支持 hdf4。
  2. I tried installing gdal via Macports as suggested by a previous thread using sudo port install gdal +hdf4 +hdf5 +netcdf , but the installation failed with the following errors:我尝试按照先前使用sudo port install gdal +hdf4 +hdf5 +netcdf线程的建议通过 Macports 安装 gdal,但安装失败并出现以下错误:

    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.错误:无法构建 gdal:命令执行失败错误:有关详细信息,请参阅 /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gis_gdal/gdal/main.log。 Error: Follow https://guide.macports.org/#project.tickets to report a bug.错误:按照https://guide.macports.org/#project.tickets报告错误。 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.错误:处理端口 gdal 失败 ---> 您安装的某些端口有注释:netcdf 有以下注释:截至版本 4.2 c++ 和 fortran 接口分别是单独的端口,netcdf-cxx 和 netcdf-fortran。

  3. I tried looking for solutions for the above errors and found none that matched mine.我尝试寻找上述错误的解决方案,但没有找到与我匹配的解决方案。 So i have given up on gdal.所以我放弃了gdal。

  4. I moved on to install pyhdf and pymodis - both failed.我继续安装 pyhdf 和 pymodis - 都失败了。 Pyhdf error was: Failed to build pyhdf ERROR: Could not build wheels for pyhdf which use PEP 517 and cannot be installed directly. Pyhdf 错误是:无法构建 pyhdf 错误:无法为使用 PEP 517 且无法直接安装的 pyhdf 构建轮子。 For pymodis, it was successful, but obviously the GDAL I installed via brew has no support for HDF4 (Error: GDAL installation has no support for HDF4, please update GDAL WxPython missing, no GUI enabled).对于pymodis,它是成功的,但显然我通过brew安装的GDAL不支持HDF4(错误:GDAL安装不支持HDF4,请更新GDAL WxPython缺少,未启用GUI)。

Any help would really be good!任何帮助真的很好!

I struggled to find an answer to this for days.这几天我一直在努力寻找答案。 I also gave up on the gdal approach and moved on to installing pyhdf but building from source was far more complicated than it was worth.我也放弃了 gdal 方法,转而安装 pyhdf,但是从源代码构建比它的价值要复杂得多。 I initially avoided using anaconda because I prefer to use virtualenv for managing virtual environments, however the easiest way to get pyhdf up and running is to:我最初避免使用 anaconda 因为我更喜欢使用 virtualenv 来管理虚拟环境,但是启动和运行 pyhdf 的最简单方法是:

  1. install anaconda安装 anaconda
  2. create a new virtual environment创建一个新的虚拟环境
  3. activate that new environment in a mac terminal window在 mac 终端 window 中激活新环境
  4. run conda install -c conda-forge pyhdf运行conda install -c conda-forge pyhdf

You will have to reinstall all your other required packages, which might be a pain but was quicker than figuring out the build from source option.您将不得不重新安装所有其他必需的软件包,这可能会很痛苦,但比找出从源代码构建选项要快。 Testye泰斯耶

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM