在pip:no-python.h中安装包失败



当尝试从pip(numba,Minell(安装包时,我得到了这个错误:

Running setup.py install for getch ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kyiq6848/getch_81d2a001bdc842c789d2feb8e967906a/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kyiq6848/getch_81d2a001bdc842c789d2feb8e967906a/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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-d0vb8bqu/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/shawn/.local/include/python3.10/getch
cwd: /tmp/pip-install-kyiq6848/getch_81d2a001bdc842c789d2feb8e967906a/
Complete output (12 lines):
running install
running build
running build_ext
building 'getch' extension
creating build
creating build/temp.linux-x86_64-3.10
gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/local/include -I/usr/include -I/usr/include/python3.10 -c getchmodule.c -o build/temp.linux-x86_64-3.10/getchmodule.o
getchmodule.c:1:10: fatal error: Python.h: No such file or directory
1 | #include <Python.h>
|          ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kyiq6848/getch_81d2a001bdc842c789d2feb8e967906a/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kyiq6848/getch_81d2a001bdc842c789d2feb8e967906a/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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-d0vb8bqu/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/shawn/.local/include/python3.10/getch Check the logs for full command output.

然而,Jupyter笔记本电脑成功安装(很抱歉一个月前我刚开始学习python(

尝试pip install --only-binary。Pip正试图从源代码进行编译,但由于没有安装python标头而失败。如果存在预编译的二进制文件,它将使生活更轻松(更快的安装,无需整理头文件(,但代价是对您的设置的优化程度稍低(=您几乎肯定不会注意到(。

或者,安装python标头。确切的方法会因您的linux而异,但您正在寻找一个名为python3-dev的包。

安装jupyter的能力是不相关的,特别是如果您安装了系统包管理器。

最新更新