3

pyhdf をインストールしようとすると、次のエラーが発生します。

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

何が間違っているのですか?ありがとうございました。

4

3 に答える 3

2

libhdf4-dev パッケージを使用しても、hdf.h ファイルが見つからないという問題が発生する可能性があります (私はそうしました)。コード setup.py (インストール アーカイブ内) は、HDF4 ライブラリの場所を指定する環境変数を適切に処理していないようです。

http://pysclint.sourceforge.net/pyhdf/install.htmlの段階的な指示に従って問題を解決しましたが、エクスポートする代わりにコマンドラインで hdf ライブラリを追加する必要があります。

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 を変更しました。

szip_installed=False

その後、インストールは正常に機能します。

于 2014-04-16T14:39:02.193 に答える
1

この問題を解決するには、まずhdf開発パッケージをインストールする必要があります。

sudo apt-get install libhdf4-dev

于 2013-09-12T08:31:33.847 に答える