这里安装了hdf5库:~/soft/lib/packages/hdf5-1.8.14-linux-centos5-x86_64-gcc412-shared/
。我使用以下命令安装h5py:
python setup.py config --include-dirs=/panfs/home/kang/yangpc/soft/lib/packages/hdf5-1.8.14-linux-centos5-x86_64-gcc412-shared/include/ build
我也尝试在MANIFEST.in文件中添加一行
graft /panfs/home/kang/yangpc/soft/lib/packages/hdf5-1.8.14-linux-centos5-x86_64-gcc412-shared/include/
。
然后我尝试将头文件路径添加到INCLUDE变量中:
export INCLUDE=$INCLUDE:/panfs/home/kang/yangpc/soft/lib/packages/hdf5-1.8.14-linux-centos5-x86_64-gcc412-shared/include/
,
然后尝试设置CPLUS_INCLUDE_PATH变量:export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/panfs/home/kang/yangpc/soft/include:/panfs/home/kang/yangpc/soft/lib/packages/hdf5-1.8.14-linux-centos5-x86_64-gcc412-shared/include/
它仍然显示下面列出的错误。似乎无法找到库头文件。但是,我已使用各种方法指定了目录。谁能提出一些建议?千万感谢!
In file included from /panfs/home/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1804,
from /panfs/home/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
from /panfs/home/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from /panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/api_compat.h:26,
from /panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:287:
/panfs/home/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
In file included from /panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:287:
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/api_compat.h:27:18: error: hdf5.h: No such file or directory
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:290:23: error: H5Cpublic.h: No such file or directory
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:291:21: error: hdf5_hl.h: No such file or directory
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:489: error: expected specifier-qualifier-list before 'H5E_auto_t'
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:686: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__pyx_f_4h5py_4defs_H5open'
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:778: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__pyx_f_4h5py_4defs_H5close'
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:870: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__pyx_f_4h5py_4defs_H5get_libversion'
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:962: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__pyx_f_4h5py_4defs_H5Acreate'
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:1054: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__pyx_f_4h5py_4defs_H5Aopen_idx'
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:1146: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__pyx_f_4h5py_4defs_H5Aopen_name'
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:1238: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__pyx_f_4h5py_4defs_H5Aclose'
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:1330: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__pyx_f_4h5py_4defs_H5Adelete'
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:1422: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__pyx_f_4h5py_4defs_H5Aread'
/panfs/home/kang/yangpc/soft/Python/Python_packages/h5py-2.5.0/h5py/defs.c:1514: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__pyx_f_4h5py_4defs_H5Awrite'
但是,当我尝试使用pip pip install h5py
进行安装时,它会出现以下错误:
pip install h5py
/panfs/home/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pip-7.0.0.dev0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting h5py
/panfs/home/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pip-7.0.0.dev0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
/panfs/home/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pip-7.0.0.dev0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Could not find a version that satisfies the requirement h5py (from versions: )
No matching distribution found for h5py
答案 0 :(得分:1)
export HDF5_DIR=/panfs/home/kang/yangpc/soft/lib/packages/hdf5-1.8.14-linux-centos5-x86_64-gcc412-shared/
python setup.py install --prefix=/anywhere/you/want/
此脚本应添加到h5py的安装README文档中。