Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在Ubuntu服务器上安装h5py_Python_Python 2.7_Installation_H5py - Fatal编程技术网

Python 在Ubuntu服务器上安装h5py

Python 在Ubuntu服务器上安装h5py,python,python-2.7,installation,h5py,Python,Python 2.7,Installation,H5py,我在Ubuntu服务器上安装了h5py。但是,它似乎返回一个未找到h5py.h的错误。当我使用pip或setup.py文件安装它时,它会给出相同的错误消息。我错过了什么 我有Numpy版本1.8.1,比要求的版本1.6或更高 完整输出如下所示: van@Hulk:~/h5py-2.3.1⟫ sudo python setup.py install libhdf5.so: cannot open shared object file: No such file or directory HDF5

我在Ubuntu服务器上安装了h5py。但是,它似乎返回一个未找到
h5py.h
的错误。当我使用
pip
setup.py
文件安装它时,它会给出相同的错误消息。我错过了什么

我有Numpy版本1.8.1,比要求的版本1.6或更高

完整输出如下所示:

van@Hulk:~/h5py-2.3.1⟫ sudo python setup.py install
libhdf5.so: cannot open shared object file: No such file or directory
HDF5 autodetection failed; building for 1.8.4+
running install
running bdist_egg
running egg_info
writing h5py.egg-info/PKG-INFO
writing top-level names to h5py.egg-info/top_level.txt
writing dependency_links to h5py.egg-info/dependency_links.txt
reading manifest file 'h5py.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.c' under directory 'win_include'
warning: no files found matching '*.h' under directory 'win_include'
writing manifest file 'h5py.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/h5py
copying h5py/ipy_completer.py -> build/lib.linux-x86_64-2.7/h5py
copying h5py/__init__.py -> build/lib.linux-x86_64-2.7/h5py
copying h5py/version.py -> build/lib.linux-x86_64-2.7/h5py
copying h5py/highlevel.py -> build/lib.linux-x86_64-2.7/h5py
creating build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/group.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/files.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/selections.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/__init__.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/filters.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/base.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/dims.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/datatype.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/dataset.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/selections2.py -> build/lib.linux-x86_64-2.7/h5py/_hl
copying h5py/_hl/attrs.py -> build/lib.linux-x86_64-2.7/h5py/_hl
creating build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_selections.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_group.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_h5.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_attrs.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_objects.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_slicing.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_h5t.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_datatype.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/__init__.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_dimension_scales.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_base.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_dataset.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_file.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_h5p.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_attrs_data.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/common.py -> build/lib.linux-x86_64-2.7/h5py/tests
copying h5py/tests/test_h5f.py -> build/lib.linux-x86_64-2.7/h5py/tests
running build_ext
skipping 'h5py/defs.c' Cython extension (up-to-date)
building 'h5py.defs' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/h5py
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DH5_USE_16_API -I/home/govinda/h5py-2.3.1/lzf -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c h5py/defs.c -o build/temp.linux-x86_64-2.7/h5py/defs.o
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from h5py/api_compat.h:26,
                 from h5py/defs.c:342:
/usr/lib/python2.7/dist-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" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it by " \
  ^
In file included from h5py/defs.c:342:0:
h5py/api_compat.h:27:18: fatal error: hdf5.h: No such file or directory
 #include "hdf5.h"
                  ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
您需要安装以获取所需的头文件。快跑

sudo apt-get install libhdf5-dev
它应该自动安装它及其依赖项

不要担心NumPy警告,这只意味着包开发人员正在使用旧版本的API,但一切都可以正常工作。

您可以使用

sudo apt get安装python-h5py

然后在Python文件中尝试:

进口h5py


通常最好使用
pip
而不是手动安装它,因为pip还将安装所有python依赖项。不过,您仍然需要头文件

因此:

就我而言(Ubuntu 15.04),安装
libhdf5 dev
是不够的

我必须跑:

HDF5_DIR=/usr/lib/x86_64-linux-gnu/HDF5/serial/pip安装h5py


为了让它工作。

我必须同时安装
libhdf5 dev
cython3
(arm64设备上的Ubuntu 18.04,Python 3.5)


非常感谢您的回答。我还需要
sudo安装cython
才能在Ubuntu 14.04上运行。我已经安装了14.04,cython没有安装,但它只在安装libhdf5-dev后工作。谢谢您的回答,它可以在Ubuntu 14.04上使用
sudo pip3安装h5py
谢谢!对于其他noob,如果您在Termux上,HDF5目录应该是
HDF5目录=/usr/lib/aarch64 linux gnu/HDF5/serial/
sudo apt-get install libhdf5-dev
pip install h5py
sudo apt install libhdf5-dev
sudo apt install cython3