首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不能安装h5py

不能安装h5py
EN

Ask Ubuntu用户
提问于 2018-11-16 11:30:55
回答 1查看 3.2K关注 0票数 3

我有Ubuntu16.04.5并试图安装Keras。我需要h5py来解决这个问题,但是我在安装它时遇到了问题。当我打字时:

代码语言:javascript
复制
sudo pip install h5py

我拿到了这个:

代码语言:javascript
复制
The directory '/home/nvidia/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/nvidia/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting h5py
  Downloading https://files.pythonhosted.org/packages/74/5d/6f11a5fffc3d8884bb8d6c06abbee0b3d7c8c81bde9819979208ba823a47/h5py-2.8.0.tar.gz (274kB)
    100% |████████████████████████████████| 276kB 1.7MB/s
Requirement already satisfied: numpy>=1.7 in /home/nvidia/.local/lib/python3.5/site-packages (from h5py) (1.15.4)
Requirement already satisfied: six in /home/nvidia/.local/lib/python3.5/site-packages (from h5py) (1.11.0)
Installing collected packages: h5py
  Running setup.py install for h5py ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-49wsh8ku/h5py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ltnxb8_8/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-aarch64-3.5
    creating build/lib.linux-aarch64-3.5/h5py
    copying h5py/__init__.py -> build/lib.linux-aarch64-3.5/h5py
    copying h5py/version.py -> build/lib.linux-aarch64-3.5/h5py
    copying h5py/h5py_warnings.py -> build/lib.linux-aarch64-3.5/h5py
    copying h5py/highlevel.py -> build/lib.linux-aarch64-3.5/h5py
    copying h5py/ipy_completer.py -> build/lib.linux-aarch64-3.5/h5py
    creating build/lib.linux-aarch64-3.5/h5py/_hl
    copying h5py/_hl/__init__.py -> build/lib.linux-aarch64-3.5/h5py/_hl
    copying h5py/_hl/selections2.py -> build/lib.linux-aarch64-3.5/h5py/_hl
    copying h5py/_hl/dims.py -> build/lib.linux-aarch64-3.5/h5py/_hl
    copying h5py/_hl/attrs.py -> build/lib.linux-aarch64-3.5/h5py/_hl
    copying h5py/_hl/base.py -> build/lib.linux-aarch64-3.5/h5py/_hl
    copying h5py/_hl/datatype.py -> build/lib.linux-aarch64-3.5/h5py/_hl
    copying h5py/_hl/dataset.py -> build/lib.linux-aarch64-3.5/h5py/_hl
    copying h5py/_hl/files.py -> build/lib.linux-aarch64-3.5/h5py/_hl
    copying h5py/_hl/compat.py -> build/lib.linux-aarch64-3.5/h5py/_hl
    copying h5py/_hl/group.py -> build/lib.linux-aarch64-3.5/h5py/_hl
    copying h5py/_hl/filters.py -> build/lib.linux-aarch64-3.5/h5py/_hl
    copying h5py/_hl/selections.py -> build/lib.linux-aarch64-3.5/h5py/_hl
    creating build/lib.linux-aarch64-3.5/h5py/tests
    copying h5py/tests/__init__.py -> build/lib.linux-aarch64-3.5/h5py/tests
    copying h5py/tests/common.py -> build/lib.linux-aarch64-3.5/h5py/tests
    creating build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/__init__.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_h5t.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_dataset.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_objects.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_group.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_h5p.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_attrs.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_dimension_scales.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_datatype.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_h5f.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_slicing.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_h5d_direct_chunk_write.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_base.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_file.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_h5.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_selections.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_attrs_data.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    copying h5py/tests/old/test_file_image.py -> build/lib.linux-aarch64-3.5/h5py/tests/old
    creating build/lib.linux-aarch64-3.5/h5py/tests/hl
    copying h5py/tests/hl/__init__.py -> build/lib.linux-aarch64-3.5/h5py/tests/hl
    copying h5py/tests/hl/test_threads.py -> build/lib.linux-aarch64-3.5/h5py/tests/hl
    ...
    warning: h5py/api_types_hdf5.pxd:493:4: 'H5T_CSET_ERROR' redeclared
    warning: h5py/api_types_hdf5.pxd:494:4: 'H5T_CSET_ASCII' redeclared
    warning: h5py/api_types_hdf5.pxd:637:2: 'H5Z_filter_t' redeclared
    warning: h5py/api_types_hdf5.pxd:672:6: 'H5Z_ERROR_EDC' redeclared
    warning: h5py/api_types_hdf5.pxd:673:6: 'H5Z_DISABLE_EDC' redeclared
    warning: h5py/api_types_hdf5.pxd:674:6: 'H5Z_ENABLE_EDC' redeclared
    warning: h5py/api_types_hdf5.pxd:675:6: 'H5Z_NO_EDC' redeclared
    [ 8/22] Cythonizing /tmp/pip-install-49wsh8ku/h5py/h5py/h5ac.pyx
    /tmp/pip-install-49wsh8ku/h5py/.eggs/Cython-0.29-py3.5-linux-aarch64.egg/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-49wsh8ku/h5py/h5py/h5ac.pxd
      tree = Parsing.p_module(s, pxd, full_module_name)
    warning: h5py/api_types_hdf5.pxd:350:2: 'H5D_layout_t' redeclared
    warning: h5py/api_types_hdf5.pxd:357:2: 'H5D_alloc_time_t' redeclared
    warning: h5py/api_types_hdf5.pxd:364:2: 'H5D_space_status_t' redeclared
    warning: h5py/api_types_hdf5.pxd:370:2: 'H5D_fill_time_t' redeclared
    warning: h5py/api_types_hdf5.pxd:376:2: 'H5D_fill_value_t' redeclared
    warning: h5py/api_types_hdf5.pxd:388:7: 'H5F_close_degree_t' redeclared
    warning: h5py/api_types_hdf5.pxd:394:2: 'H5FD_mem_t' redeclared
   ...
    building 'h5py.defs' extension
    creating build/temp.linux-aarch64-3.5
    creating build/temp.linux-aarch64-3.5/tmp
    creating build/temp.linux-aarch64-3.5/tmp/pip-install-49wsh8ku
    creating build/temp.linux-aarch64-3.5/tmp/pip-install-49wsh8ku/h5py
    creating build/temp.linux-aarch64-3.5/tmp/pip-install-49wsh8ku/h5py/h5py
    aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DH5_USE_16_API -I./h5py -I/tmp/pip-install-49wsh8ku/h5py/lzf -I/opt/local/include -I/usr/local/include -I/home/nvidia/.local/lib/python3.5/site-packages/numpy/core/include -I/usr/include/python3.5m -c /tmp/pip-install-49wsh8ku/h5py/h5py/defs.c -o build/temp.linux-aarch64-3.5/tmp/pip-install-49wsh8ku/h5py/h5py/defs.o
    In file included from /home/nvidia/.local/lib/python3.5/site-packages/numpy/core/include/numpy/ndarraytypes.h:1821:0,
                     from /home/nvidia/.local/lib/python3.5/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                     from /home/nvidia/.local/lib/python3.5/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from /tmp/pip-install-49wsh8ku/h5py/h5py/api_compat.h:26,
                     from /tmp/pip-install-49wsh8ku/h5py/h5py/defs.c:654:
    /home/nvidia/.local/lib/python3.5/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" [-Wcpp]
     #warning "Using deprecated NumPy API, disable it by " \
      ^
    In file included from /tmp/pip-install-49wsh8ku/h5py/h5py/defs.c:654:0:
    /tmp/pip-install-49wsh8ku/h5py/h5py/api_compat.h:27:18: fatal error: hdf5.h: No such file or directory
    compilation terminated.
    error: command 'aarch64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-49wsh8ku/h5py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ltnxb8_8/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-49wsh8ku/h5py/

我试过清除缓存、升级pip或使用什么都帮不上忙。我该怎么办?

EN

回答 1

Ask Ubuntu用户

回答已采纳

发布于 2018-11-16 11:35:13

可以使用以下命令从Ubuntu18.04和更早版本的默认存储库中安装h5py for Python2.x:

代码语言:javascript
复制
sudo apt install python-h5py

可以从所有当前支持的Ubuntu版本的默认存储库中安装h5py for Python3.x,并使用以下命令:

代码语言:javascript
复制
sudo apt install python3-h5py  

HDF5 for Python (h5py)是一个通用的Python接口,它是一个通用的数据格式库,版本5。HDF5是一个通用的、成熟的科学软件库,旨在快速、灵活地存储大量数据。

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

https://askubuntu.com/questions/1093441

复制
相关文章

相似问题

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