安装pip套件时出现“ regex的建筑轮子失败”

Saš*_*ašo 4 python pip debian-stretch

我在运行Debian Stretch的Windows 10 WSL上安装pip软件包时遇到问题。

运行时sudo pip install invoice2datapython3-pip安装后遇到以下错误。

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Failed building wheel for regex
Running setup.py clean for regex
Failed to build regex

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c regex_2/_regex.c -o build/temp.linux-x86_64-2.7/regex_2/_regex.o
regex_2/_regex.c:46:20: fatal error: Python.h: No such file or directory
 #include "Python.h"
                    ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, okenize;__file__='/tmp/pip-install-D9zG6P/regex/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-0dvlsB/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-D9zG6P/regex/
Run Code Online (Sandbox Code Playgroud)

Saš*_*ašo 9

WSL与该问题无关,这是一个相当标准的错误。

确保已安装以下软件包。使用安装它们apt-get install packagename。通过安装可以解决此特定时间的问题python-dev

python3
python3-pip
ipython3
build-essential
python-dev
python3-dev
Run Code Online (Sandbox Code Playgroud)

  • 你的意思是`python3-dev`而不是`python-dev3`不是吗? (2认同)