提示:环境搭建
前言
提示:版本
ubuntu 24.04
python 3.10
pip install cython-bbox==0.1.5 -i https://pypi.mirrors.ustc.edu.cn/simple
ERROR: Failed to build installable wheels for some pyproject.toml based projects (cython-bbox)
提示:cython-bbox 安装报错 , Failed to build xxx
一、报错
pip install cython-bbox==0.1.5 -i https://mirrors.aliyun.com/pypi/simple/
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting cython-bbox==0.1.5
Using cached https://mirrors.aliyun.com/pypi/packages/21/8f/fcf24b032c7d501a995e9c8420ac5e601d8fd883dd045522b63b7869cabd/cython_bbox-0.1.5.tar.gz (4.4 kB)
Preparing metadata (setup.py) ... done
Collecting Cython (from cython-bbox==0.1.5)
Downloading https://mirrors.aliyun.com/pypi/packages/dc/21/5b700dac60cc7af4261c7fa2e91f55fe5f38f6c183e1201ced7cc932201b/Cython-3.0.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.6/3.6 MB 10.7 MB/s eta 0:00:00
Requirement already satisfied: numpy in ./miniconda3/envs/py310/lib/python3.10/site-packages (from cython-bbox==0.1.5) (1.26.4)
Building wheels for collected packages: cython-bbox
Building wheel for cython-bbox (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
/root/miniconda3/envs/py310/lib/python3.10/site-packages/setuptools/__init__.py:94: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!
********************************************************************************
Requirements should be satisfied by a PEP 517 installer.
If you are using pip, you can try `pip install --use-pep517`.
********************************************************************************
!!
dist.fetch_build_eggs(dist.setup_requires)
running bdist_wheel
running build
running build_ext
Compiling src/cython_bbox.pyx because it changed.
[1/1] Cythonizing src/cython_bbox.pyx
/tmp/pip-install-x1di4hum/cython-bbox_c03c7fbd96354de8940fe78607b257cf/.eggs/Cython-3.0.12-py3.10-linux-x86_64.egg/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/pip-install-x1di4hum/cython-bbox_c03c7fbd96354de8940fe78607b257cf/src/cython_bbox.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'cython_bbox' extension
creating build/temp.linux-x86_64-cpython-310/src
gcc -pthread -B /root/miniconda3/envs/py310/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /root/miniconda3/envs/py310/include -fPIC -O2 -isystem /root/miniconda3/envs/py310/include -fPIC -I/root/miniconda3/envs/py310/lib/python3.10/site-packages/numpy/core/include -I/root/miniconda3/envs/py310/include/python3.10 -c src/cython_bbox.c -o build/temp.linux-x86_64-cpython-310/src/cython_bbox.o -Wno-cpp
error: command 'gcc' failed: No such file or directory
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cython-bbox
Running setup.py clean for cython-bbox
Failed to build cython-bbox
ERROR: Failed to build installable wheels for some pyproject.toml based projects (cython-bbox)
- PEP 517 PEP 517 是 Python 构建系统标准化提案
二、解决
二选一
# 全局安装
apt update && sudo apt install build-essential python3-dev
# conda 环境安装,仅对当前 Conda 环境生效
conda install gcc_linux-64 gxx_linux-64
ok la ,