用pip安装出现报错,并且这个包网上查了很多都没办法解决,于是来记录一下我的解决方法。
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kjoo0n5h/lap_0fdf00f39639412081865616dc35696f/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kjoo0n5h/lap_0fdf00f39639412081865616dc35696f/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-fp9ptui3
cwd: /tmp/pip-install-kjoo0n5h/lap_0fdf00f39639412081865616dc35696f/
Complete output (22 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
/usr/local/lib/python3.8/dist-packages/setuptools/command/install.py:34: 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.8
creating build/lib.linux-x86_64-3.8/lap
copying lap/lapmod.py -> build/lib.linux-x86_64-3.8/lap
copying lap/__init__.py -> build/lib.linux-x86_64-3.8/lap
running build_ext
creating build/temp.linux-x86_64-3.8/lap
lap/_lapjv.cpp:4:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: Command "x86_64-linux-gnu-g++ -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -Ilap -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/include/python3.8 -c lap/_lapjv.cpp -o build/temp.linux-x86_64-3.8/lap/_lapjv.o -MMD -MF build/temp.linux-x86_64-3.8/lap/_lapjv.o.d" failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for lap
解决方法
try this:
sudo apt install libpython3.8-dev
python 版本根据自己而定
再次安装就是success