首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在ubuntu 13.04上安装pyhdf

无法在ubuntu 13.04上安装pyhdf
EN

Stack Overflow用户
提问于 2013-09-12 16:02:57
回答 3查看 2.5K关注 0票数 3

当我尝试安装pyhdf时,发生以下错误:

代码语言:javascript
复制
sudo easy_install -f pyhdf-0.8.3.tar.gz pyhdf
Searching for pyhdf
Best match: pyhdf 0.8.3
Processing pyhdf-0.8.3.tar.gz
Writing /tmp/easy_install-Q0FIMR/pyhdf-0.8.3/setup.cfg
Running pyhdf-0.8.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Q0FIMR/pyhdf-0.8.3/egg-dist-tmp-wXq_6K
pyhdf/hdfext_wrap.c: In function ‘SWIG_Python_AddErrorMsg’:
pyhdf/hdfext_wrap.c:859:5: warning: format not a string literal and no format arguments [-Wformat-security]
pyhdf/hdfext_wrap.c: At top level:
pyhdf/hdfext_wrap.c:3048:17: fatal error: hdf.h: No such file or directory
compilation terminated.
pyhdf/hdfext_wrap.c: In function ‘SWIG_Python_AddErrorMsg’:
pyhdf/hdfext_wrap.c:859:5: warning: format not a string literal and no format arguments [-Wformat-security]
pyhdf/hdfext_wrap.c: At top level:
pyhdf/hdfext_wrap.c:3048:17: fatal error: hdf.h: No such file or directory
compilation terminated.
error: Setup script exited with error: Command "x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -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
/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py:252: RuntimeWarning: Parent module 'numpy.distutils' not found while handling absolute import
  from numpy.distutils import log

你知道哪里出问题了吗?谢谢。

EN

回答 3

Stack Overflow用户

发布于 2013-09-12 16:06:18

您可能需要安装libhdf4-dev包。

花点时间阅读virtualenv,而不是使用sudo将包安装到您的系统中。

票数 4
EN

Stack Overflow用户

发布于 2014-04-16 22:39:02

即使使用libhdf4-dev包,您也会遇到hdf.h文件丢失的问题(我就是这样做的)。代码setup.py (在安装存档中)似乎没有正确处理指定HDF4库所在位置的环境变量。

我按照http://pysclint.sourceforge.net/pyhdf/install.html的分步说明解决了这个问题,但是你必须在命令行中添加你的hdf库,而不是导出它:

代码语言:javascript
复制
INCLUDE_DIRS=/usr/include/hdf/  [note it may be different in your system ]

sudo python setup.py install -i $INCLUDE_DIRS

如果您没有/想要szlib,那么NOSZIP变量也会出现同样的问题,但这里我在第29行修改了setup.py:

代码语言:javascript
复制
szip_installed=False

那么安装就没问题了。

票数 2
EN

Stack Overflow用户

发布于 2013-09-12 16:31:34

要解决此问题,首先需要安装hdf开发包。

sudo apt-get install libhdf4-dev

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18758723

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档