我在嘗試安裝這兩個庫(Cython_bbox 和 lap)時遇到了這些奇怪的錯誤,它們是我運行時需要的其他庫的一部分pip install -r requirements.txt,其中包含以下內容
yacs
opencv-python
PyYAML
cython-bbox
scipy
progress
motmetrics
matplotlib
lap
openpyxl
Pillow
tensorboardX
fvcore
這是從以下鏈接中找到的:https : //github.com/ifzhang/FairMOT
這是我得到的一大堆錯誤。
rc/cython_bbox.c:31:10: fatal error: Python.h: No such file or directory
31 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for cython-bbox
Running setup.py clean for cython-bbox
Building wheel for lap (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/aevas/Desktop/pyenvs/fairmotpy39/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-dweujmo4/lap_14d06a4a011f45a69d78f1a214bd5715/setup.py'"'"'; __file__='"'"'/tmp/pip-install-dweujmo4/lap_14d06a4a011f45a69d78f1a214bd5715/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-pzh48d16
cwd: /tmp/pip-install-dweujmo4/lap_14d06a4a011f45a69d78f1a214bd5715/
Complete output (34 lines):
Partial import of lap during the build process.
Generating cython files
running bdist_wheel
running build
running config_cc
running config_fc
running build_src
SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/lap
copying lap/lapmod.py -> build/lib.linux-x86_64-3.9/lap
copying lap/__init__.py -> build/lib.linux-x86_64-3.9/lap
running build_ext
creating /tmp/tmpijpimqcg/home
creating /tmp/tmpijpimqcg/home/aevas
creating /tmp/tmpijpimqcg/home/aevas/Desktop
creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs
creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39
creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39/lib
creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9
creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages
creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy
creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/distutils
creating /tmp/tmpijpimqcg/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/distutils/checks
CCompilerOpt.generate_dispatch_header[2281] : dispatch header dir build/src.linux-x86_64-3.9/numpy/distutils/include does not exist, creating it
creating build/temp.linux-x86_64-3.9/lap
lap/_lapjv.cpp:4:10: fatal error: Python.h: No such file or directory
4 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: Command "x86_64-linux-gnu-g -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/core/include -Ilap -I/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/core/include -Ibuild/src.linux-x86_64-3.9/numpy/distutils/include -I/home/aevas/Desktop/pyenvs/fairmotpy39/include -I/usr/include/python3.9 -c lap/_lapjv.cpp -o build/temp.linux-x86_64-3.9/lap/_lapjv.o -MMD -MF build/temp.linux-x86_64-3.9/lap/_lapjv.o.d -msse -msse2 -msse3" failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for lap
Running setup.py install for lap ... error
ERROR: Command errored out with exit status 1:
warnings.warn(
running build
running config_cc
running config_fc
running build_src
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/lap
copying lap/lapmod.py -> build/lib.linux-x86_64-3.9/lap
copying lap/__init__.py -> build/lib.linux-x86_64-3.9/lap
running build_ext
creating /tmp/tmplmbzif7h/home
creating /tmp/tmplmbzif7h/home/aevas
creating /tmp/tmplmbzif7h/home/aevas/Desktop
creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs
creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39
creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39/lib
creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9
creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages
creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy
creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/distutils
creating /tmp/tmplmbzif7h/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/distutils/checks
CCompilerOpt.generate_dispatch_header[2281] : dispatch header dir build/src.linux-x86_64-3.9/numpy/distutils/include does not exist, creating it
creating build/temp.linux-x86_64-3.9/lap
lap/_lapjv.cpp:4:10: fatal error: Python.h: No such file or directory
4 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: Command "x86_64-linux-gnu-g -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/core/include -Ilap -I/home/aevas/Desktop/pyenvs/fairmotpy39/lib/python3.9/site-packages/numpy/core/include -Ibuild/src.linux-x86_64-3.9/numpy/distutils/include -I/home/aevas/Desktop/pyenvs/fairmotpy39/include -I/usr/include/python3.9 -c lap/_lapjv.cpp -o build/temp.linux-x86_64-3.9/lap/_lapjv.o -MMD -MF build/temp.linux-x86_64-3.9/lap/_lapjv.o.d -msse -msse2 -msse3" failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1:
我將它安裝在運行 python3.9 的全新虛擬環境中。我沒有使用任何 conda 環境。如果需要,這是我的系統規格
11th Gen Intel? Core? i7-11850H @ 2.50GHz × 16
llvmpipe (LLVM 12.0.0, 256 bits) / Mesa Intel? UHD Graphics (TGL GT1)
Ubuntu 21.04 64-bit
我嘗試過的事情
- 查看 stackoverflow.com/search?q=#include "Python.h" not found
uj5u.com熱心網友回復:
試試這個 :
sudo apt install libpython3.9-dev
這將安裝頭檔案,如 Python.h
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/398346.html
