gpt4 book ai didi

python - 构建 h5py : deprecated numpy 时出错

转载 作者:行者123 更新时间:2023-11-28 17:37:08 25 4
gpt4 key购买 nike

我正在尝试使用以下方法从终端构建 h5py: git 克隆 http://github.com/h5py/h5py.git ,然后cd/h5py,然后

     sudo python setup.py install.

它似乎开始构建,但随后遇到某种错误而无法构建。请查看下面的日志:

> In file included from
> /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1803:0,
> from /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
> from /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
> from /home/user/h5py/h5py/api_compat.h:26,
> from /home/user/h5py/h5py/defs.c:287: /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:12: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 #defining NPY_NO_DEPRECATED_API
> NPY_1_7_API_VERSION" ^
> /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:24:2:
> error: #error Should never include npy_deprecated_api directly.
> #error Should never include npy_deprecated_api directly. ^ In file included from
> /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:127:0,
> from /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1803,
> from /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
> from /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
> from /home/user/h5py/h5py/api_compat.h:26,
> from /home/user/h5py/h5py/defs.c:287: /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/old_defines.h:5:0:
> warning: "NPY_NO_DEPRECATED_API" redefined [enabled by default]
> #define NPY_NO_DEPRECATED_API NPY_1_9_API_VERSION ^ In file included from
> /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1803:0,
> from /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
> from /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
> from /home/user/h5py/h5py/api_compat.h:26,
> from /home/user/h5py/h5py/defs.c:287: /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:3:0:
> note: this is the location of the previous definition #define
> NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION ^ In file included from
> /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:127:0,
> from /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1803,
> from /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
> from /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
> from /home/user/h5py/h5py/api_compat.h:26,
> from /home/user/h5py/h5py/defs.c:287: /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/old_defines.h:7:2:
> error: #error The header "old_defines.h" is deprecated as of NumPy
> 1.7. #error The header "old_defines.h" is deprecated as of NumPy 1.7. ^ In file included from
> /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
> from /home/user/.local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
> from /home/user/h5py/h5py/api_compat.h:26,
> from /home/user/h5py/h5py/defs.c:287: /home/saliba/.local/lib/python2.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:1629:1:
> warning: ‘_import_array’ defined but not used [-Wunused-function]
> _import_array(void) ^ error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

关于如何修复弃用的任何想法?我有 numpy 版本 1.9.2 并试图降级 1.7.1 但还没有找到办法。

谢谢:D

最佳答案

我刚刚安装了 h5py,是的,numpy 是一个依赖项。

numpy==1.11.2
h5py==2.6.0

由于缺少 hdf5 开发库,我遇到了 h5py 安装失败 - 在标准输出中也出现了 numpy api 弃用警告:

/home/ahmed/virtualenvs/venv_anytime_rc/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" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by " \

失败的主要原因是缺少 hdf5 开发库,安装包后问题得到解决

对于 CentOS

sudo yum -y install hdf5-devel

对于 Ubuntu

sudo apt-get install libhdf5-dev

注意:以上命令将安装hdf5开发库版本1.8.12

关于python - 构建 h5py : deprecated numpy 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29309041/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com