gpt4 book ai didi

python - 安装pyhdf报错: hdf. h: No such file or directory

转载 作者:太空宇宙 更新时间:2023-11-04 05:24:55 24 4
gpt4 key购买 nike

我想安装pyhdf来在ubuntu上用python读取hdf4文件,我从https://sourceforge.net/projects/pysclint/files/pyhdf/下载的,pyhdf-0.8.3.tar.gz,但是当我在 ubuntu 上运行 python setup.py install 时,它显示

running install
running bdist_egg
running egg_info
running build_src
build_src
building extension "pyhdf._hdfext" sources
build_src: building npy-pkg config files
writing pyhdf.egg-info/PKG-INFO
writing top-level names to pyhdf.egg-info/top_level.txt
writing dependency_links to pyhdf.egg-info/dependency_links.txt
reading manifest file 'pyhdf.egg-info/SOURCES.txt'
writing manifest file 'pyhdf.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
building 'pyhdf._hdfext' extension
compiling C sources
C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC

compile options: '-I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c'
x86_64-linux-gnu-gcc: pyhdf/hdfext_wrap.c
pyhdf/hdfext_wrap.c: In function ‘SWIG_Python_AddErrorMsg’:
pyhdf/hdfext_wrap.c:859:5: error: format not a string literal and no format arguments [-Werror=format-security]
PyErr_Format(PyExc_RuntimeError, mesg);
^
pyhdf/hdfext_wrap.c: At top level:
pyhdf/hdfext_wrap.c:3048:17: fatal error: hdf.h: No such file or directory
cc1: some warnings being treated as errors
compilation terminated.
pyhdf/hdfext_wrap.c: In function ‘SWIG_Python_AddErrorMsg’:
pyhdf/hdfext_wrap.c:859:5: error: format not a string literal and no format arguments [-Werror=format-security]
PyErr_Format(PyExc_RuntimeError, mesg);
^
pyhdf/hdfext_wrap.c: At top level:
pyhdf/hdfext_wrap.c:3048:17: fatal error: hdf.h: No such file or directory
cc1: some warnings being treated as errors
compilation terminated.
error: Command "x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c pyhdf/hdfext_wrap.c -o build/temp.linux-x86_64-2.7/pyhdf/hdfext_wrap.o" failed with exit status 1

如何解决?

最佳答案

好吧,现在我终于要回答我自己的问题了...对于那些想在 ubuntu 上安装 python-hdf4 的人。

首先你需要安装hdf4,然后是python-hdf4。

HDF4 可以从 https://www.hdfgroup.org/products/hdf4/ 下载,然后使用tar xvf ...unzip 文件,cd 到文件和/.configure,如果你不需要 fortran 然后做 ./configure --disable-fortran,它应该被配置,然后 makemake check , make install 一步一步,HDF4应该安装成功。

接下来的事情很简单,从 https://pypi.python.org/pypi/python-hdf4 下载 python-hdf4然后cd到文件,python setup.py install,完成!

关于python - 安装pyhdf报错: hdf. h: No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39157914/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com