首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装pip软件包时“regex的失败建筑车轮”

安装pip软件包时“regex的失败建筑车轮”
EN

Stack Overflow用户
提问于 2018-12-12 13:58:12
回答 6查看 18.7K关注 0票数 7

我在Windows 10 WSL上安装pip软件包时遇到了问题,运行Debian拉伸。

在运行sudo pip install invoice2data时,安装了python3-pip后,我会遇到以下错误。

代码语言:javascript
复制
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/
EN

回答 6

Stack Overflow用户

回答已采纳

发布于 2018-12-12 13:58:12

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

确保安装了下列软件包。使用apt-get install packagename安装它们。通过安装python-dev解决了这个特定时间的问题。

代码语言:javascript
复制
python3
python3-pip
ipython3
build-essential
python-dev
python3-dev

作为一个单一的命令:

代码语言:javascript
复制
sudo apt-get install python3 python3-pip ipython3 build-essential python-dev python3-dev
票数 17
EN

Stack Overflow用户

发布于 2020-05-21 12:06:42

运行pip3 install pyinquirer时出现了类似的错误

代码语言:javascript
复制
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-a7ojseph/regex/setup.py'"'"'; __file__='"'"'/tmp/pip-install-a7ojseph/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-bodowot9/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/regex Check the logs for full command output.

安装python3-dev对我不起作用,因为我已经安装了它。然而,安装build-essential就成功了,regex模块也成功安装了。

票数 1
EN

Stack Overflow用户

发布于 2020-11-25 22:28:27

我在Ubuntu上运行Python3.5。我是如何安装regex包的:

代码语言:javascript
复制
$ sudo apt-get install libpython3.5-dev
$ pip3 install regex --no-use-wheel

背景研究详情:

通过使用Python.h来定位缺少的apt-file文件,我确定了它的包名。

代码语言:javascript
复制
# install the apt-file package in case you don't have it
$ sudo apt-get install apt-file

# populate/refresh the local apt-file package data
$ sudo apt-file update

# search for /Python.h.  Since it's a C header file,
# I also grep for /include to limit the results.
$ sudo apt-file search /Python.h | grep /include
libpython2.7-dbg: /usr/include/python2.7_d/Python.h
libpython2.7-dev: /usr/include/python2.7/Python.h
libpython3.5-dbg: /usr/include/python3.5dm/Python.h
libpython3.5-dev: /usr/include/python3.5m/Python.h
pypy-dev: /usr/lib/pypy/include/Python.h

然后对我需要的包裹做了一个有教养的猜测。忽略Python2,忽略调试(dbg),忽略pypy,从而留下libpython3.5-dev。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53744668

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档