我正在尝试安装
mip
(用于数学优化的Python-MIP包)。但是,我遇到了 cffi 包的问题。下面是命令pip install mip
的结果:
pip install mip
Collecting mip
Using cached mip-1.14.2-py3-none-any.whl.metadata (21 kB)
Collecting cffi==1.15.0 (from mip)
Using cached cffi-1.15.0.tar.gz (484 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pycparser in ./.venv/lib/python3.12/site-packages (from cffi==1.15.0->mip) (2.22)
Using cached mip-1.14.2-py3-none-any.whl (15.3 MB)
Building wheels for collected packages: cffi
Building wheel for cffi (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for cffi (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
running bdist_wheel
running build
running build_py
creating build/lib.linux-x86_64-cpython-312/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/api.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/error.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/model.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/pkgconfig.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-cpython-312/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-cpython-312/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-cpython-312/c
x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/home/santos/Documentos/mathprog/.venv/include -I/usr/include/python3.12 -c c/_cffi_backend.c -o build/temp.linux-x86_64-cpython-312/c/_cffi_backend.o
c/_cffi_backend.c:2:10: fatal error: Python.h: Arquivo ou diretório inexistente
2 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cffi
Failed to build cffi
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (cffi)
cffi 会发生什么? 在 x86_64 处理器架构上使用 Debian 12 GNU/Linux。
修复它的唯一尝试是检查 mip 包文档,看看是否仍然存在我不知道的依赖项。但没有。