ubuntu已解决h5py安装报错:Building wheel for h5py (setup.py) ... 或 ERROR: Failed building wheel for h5py

在JetsonNano上安装h5py遇到Cython错误?本文详细介绍了解决方案,确保在Ubuntu18.04LTS环境下顺利安装h5py。

前言

笔者硬件为:jetson nano
系统为:ubuntu 18.04 LTS

问题描述

尝试安装h5py:install pip h5py时报错。
在这里插入图片描述

浏览了一下错误日志,发现“亿”堆warning最后笔者定睛在了Cython的一处错误:Error compiling Cython file

在这里插入图片描述

研究后发现。实际上是没有安装Cython。这意味着,当我们使用pip3 install h5py安装h5py时,安装程​​序将下载Cython的临时副本可能发生了与h5py兼容的问题。
于是,请在运行pip install h5py之前先安装Cython,然后再安装h5py即可:

install pip Cython

install pip h5py
成功安装

在这里插入图片描述

(hkj) E:\kj-2\Nets\SCANet-master\SCANet-master>pip install numpy==1.16.4 h5py==2.10.0 Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting numpy==1.16.4 Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d3/4b/f9f4b96c0b1ba43d28a5bdc4b64f0b9d3fbcf31313a51bc766942866a7c7/numpy-1.16.4.zip (5.1 MB) Preparing metadata (setup.py) ... done Collecting h5py==2.10.0 Using cached https://pypi.tuna.tsinghua.edu.cn/packages/5f/97/a58afbcf40e8abecededd9512978b4e4915374e5b80049af082f49cebe9a/h5py-2.10.0.tar.gz (301 kB) Preparing metadata (setup.py) ... done Collecting six (from h5py==2.10.0) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl (11 kB) Building wheels for collected packages: numpy, h5py DEPRECATION: Building 'numpy' using the legacy setup.py bdist_wheel mechanism, which will be removed in a future version. pip 25.3 will enforce this behaviour change. A possible replacement is to use the standardized build interface by setting the `--use-pep517` option, (possibly combined with `--no-build-isolation`), or adding a `pyproject.toml` file to the source tree of 'numpy'. Discussion can be found at https://github.com/pypa/pip/issues/6334 Building wheel for numpy (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [15 lines of output] Running from numpy source directory. C:\Users\401\AppData\Local\Temp\pip-install-ibl1f_tz\numpy_0a9d864bca3c447581afe245023bc65e\numpy\distutils\misc_util.py:476: SyntaxWarning: "is" with a literal. Did you mean "=="? return is_string(s) and ('*' in s or '?' is s) Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 35, in <module> File "C:\Users\401\AppData\Local\Temp\pip-install-ibl1f_tz\numpy_0a9d864bca3c447581afe245023bc65e\setup.py", line 415, in <module> setup_package() File "C:\Users\401\AppData\Local\Temp\pip-install-ibl1f_tz\numpy_0a9d864bca3c447581afe245023bc65e\setup.py", line 394, in setup_package from numpy.distutils.core import setup File "C:\Users\401\AppData\Local\Temp\pip-install-ibl1f_tz\numpy_0a9d864bca3c447581afe245023bc65e\numpy\distutils\__init__.py", line 6, in <module> from . import ccompiler File "C:\Users\401\AppData\Local\Temp\pip-install-ibl1f_tz\numpy_0a9d864bca3c447581afe245023bc65e\numpy\distutils\ccompiler.py", line 111, in <module> replace_method(CCompiler, 'find_executables', CCompiler_find_executables) NameError: name 'CCompiler' is not defined [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for numpy Running setup.py clean for numpy error: subprocess-exited-with-error × python setup.py clean did not run successfully. │ exit code: 1 ╰─> [10 lines of output] Running from numpy source directory. `setup.py clean` is not supported, use one of the following instead: - `git clean -xdf` (cleans all files) - `git clean -Xdf` (cleans all versioned files, doesn't touch files that aren't checked into the git repo) Add `--force` to your command to use it anyway if you must (unsupported). [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed cleaning build dir for numpy DEPRECATION: Building 'h5py' using the legacy setup.py bdist_wheel mechanism, which will be removed in a future version. pip 25.3 will enforce this behaviour change. A possible replacement is to use the standardized build interface by setting the `--use-pep517` option, (possibly combined with `--no-build-isolation`), or adding a `pyproject.toml` file to the source tree of 'h5py'. Discussion can be found at https://github.com/pypa/pip/issues/6334 Building wheel for h5py (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [529 lines of output]
10-18
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值