![](/img/trans.png)
[英]Error while installing turicreate using pip …while building wheel for llvmlite
[英]"Failed building wheel for regex" while installing pip package
我在運行 Debian Stretch 的 Windows 10 WSL 上安裝 pip 包時遇到問題。
在運行sudo pip install invoice2data
並安裝了python3-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/
WSL 與問題無關,這是一個相當標准的錯誤。
確保安裝了以下軟件包。 使用apt-get install packagename
安裝它們。 通過安裝python-dev
解決了這個特定時間的問題。
python3
python3-pip
ipython3
build-essential
python-dev
python3-dev
作為單個命令:
sudo apt-get install python3 python3-pip ipython3 build-essential python-dev python3-dev
運行pip3 install pyinquirer
時出現類似錯誤
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
成功了,並且成功安裝了正則表達式模塊。
我在 Ubuntu 上運行 Python 3.5。 我如何能夠安裝regex
Python 包是:
$ sudo apt-get install libpython3.5-dev
$ pip3 install regex --no-use-wheel
背景研究細節:
我通過使用apt-file
來確定提供缺少的Python.h
文件的包名稱。
# 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。
當我在 Alpine 上遇到類似錯誤時,我登陸了此頁面,因此當他遇到類似問題時,我會將這個解決方案留給備用我 :)
apk 添加構建基礎--no-cache
重新啟動 bash。 我有同樣的錯誤,但重新啟動有幫助
如果您的解釋器是 pypy,則安裝以下軟件包:使用sudo apt-get install 'packagename'
pypy3
pypy3-pip
ipypy3
build-essential
pypy-dev
pypy3-dev
非常適合安裝 nltk 和 regex
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.