"error: command 'gcc' failed with exit status 1" when trying to install python-language-server
"error: command 'gcc' failed with exit status 1" when trying to install python-language-server
我的系统中安装了以下 pip
$ pip --version
pip 19.3.1 from /usr/lib/python3.8/site-packages/pip (python 3.8)
python 我系统安装的版本是-
$ python --version
Python 3.8.3
我正在尝试安装 python-language-server
并遇到以下错误 -
Running setup.py install for ujson ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-yoqmgayp/ujson/setup.py'"'"'; file='"'"'/tmp/pip-install-yoqmgayp/ujson/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-h4azsb93/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-yoqmgayp/ujson/
Complete output (16 lines):
Warning: 'classifiers' should be a list, got type 'filter'
running install
running build
running build_ext
building 'ujson' extension
creating build
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/python
creating build/temp.linux-x86_64-3.8/lib
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I./python -I./lib -I/usr/include/python3.8 -c ./python/ujson.c -o build/temp.linux-x86_64-3.8/./python/ujson.o -D_GNU_SOURCE
In file included from ./python/ujson.c:39:
./python/py_defines.h:39:10: fatal error: Python.h: No such file or directory
39 | #include
| ^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-yoqmgayp/ujson/setup.py'"'"'; file='"'"'/tmp/pip-install-yoqmgayp/ujson/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-h4azsb93/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
以下是我的 OS 详细信息 -
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 32 (Thirty Two)
Release: 32
Codename: ThirtyTwo
我该如何解决这个错误?
如果您阅读消息这个词,它会告诉您哪里出了问题
./python/py_defines.h:39:10: fatal error: Python.h: No such file or directory
说找不到头文件。询问 dnf
是什么提供了它:
sudo dnf provides '*/Python.h'
然后安装该软件包 (sudo dnf install ...
) 并重试您的原始命令。
我的系统中安装了以下 pip
$ pip --version
pip 19.3.1 from /usr/lib/python3.8/site-packages/pip (python 3.8)
python 我系统安装的版本是-
$ python --version
Python 3.8.3
我正在尝试安装 python-language-server
并遇到以下错误 -
Running setup.py install for ujson ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-yoqmgayp/ujson/setup.py'"'"'; file='"'"'/tmp/pip-install-yoqmgayp/ujson/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-h4azsb93/install-record.txt --single-version-externally-managed --compile cwd: /tmp/pip-install-yoqmgayp/ujson/ Complete output (16 lines): Warning: 'classifiers' should be a list, got type 'filter' running install
running build
running build_ext
building 'ujson' extension
creating build
creating build/temp.linux-x86_64-3.8 creating build/temp.linux-x86_64-3.8/python creating build/temp.linux-x86_64-3.8/lib gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I./python -I./lib -I/usr/include/python3.8 -c ./python/ujson.c -o build/temp.linux-x86_64-3.8/./python/ujson.o -D_GNU_SOURCE In file included from ./python/ujson.c:39: ./python/py_defines.h:39:10: fatal error: Python.h: No such file or directory 39 | #include | ^~~~~~~~~~ compilation terminated. error: command 'gcc' failed with exit status 1
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-yoqmgayp/ujson/setup.py'"'"'; file='"'"'/tmp/pip-install-yoqmgayp/ujson/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-h4azsb93/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
以下是我的 OS 详细信息 -
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 32 (Thirty Two)
Release: 32
Codename: ThirtyTwo
我该如何解决这个错误?
如果您阅读消息这个词,它会告诉您哪里出了问题
./python/py_defines.h:39:10: fatal error: Python.h: No such file or directory
说找不到头文件。询问 dnf
是什么提供了它:
sudo dnf provides '*/Python.h'
然后安装该软件包 (sudo dnf install ...
) 并重试您的原始命令。