我在:Centos:3.10.0-957.21.3.el7.x86_64#1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU / Linux
当我运行pip install regex时,出现以下错误
尝试谷歌搜索
Collecting regex
Using cached https://files.pythonhosted.org/packages/6f/4e/1b178c38c9a1a184288f72065a65ca01f3154df43c6ad898624149b8b4e0/regex-2019.06.08.tar.gz
Installing collected packages: regex
Running setup.py install for regex ... error
ERROR: Complete output from command /usr/bin/python2 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-b8IfSq/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-25oOBE/install-record.txt --single-version-externally-managed --compile:
ERROR: BASE_DIR is /tmp/pip-install-b8IfSq/regex
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/regex
copying regex_2/regex/__init__.py -> build/lib.linux-x86_64-2.7/regex
copying regex_2/regex/regex.py -> build/lib.linux-x86_64-2.7/regex
copying regex_2/regex/_regex_core.py -> build/lib.linux-x86_64-2.7/regex
creating build/lib.linux-x86_64-2.7/regex/test
copying regex_2/regex/test/__init__.py -> build/lib.linux-x86_64-2.7/regex/test
copying regex_2/regex/test/test_regex.py -> build/lib.linux-x86_64-2.7/regex/test
running build_ext
building 'regex._regex' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/regex_2
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -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: In function ‘get_string’:
regex_2/_regex.c:18517:20: erreur: ‘PyBufferProcs’ has no member named ‘bf_getreadbuffer’
else if (buffer->bf_getreadbuffer && buffer->bf_getsegcount &&
^
regex_2/_regex.c:18517:48: erreur: ‘PyBufferProcs’ has no member named ‘bf_getsegcount’
else if (buffer->bf_getreadbuffer && buffer->bf_getsegcount &&
^
regex_2/_regex.c:18518:13: erreur: ‘PyBufferProcs’ has no member named ‘bf_getsegcount’
buffer->bf_getsegcount(string, NULL) == 1)
^
regex_2/_regex.c:18539:23: erreur: ‘PyBufferProcs’ has no member named ‘bf_getreadbuffer’
bytes = buffer->bf_getreadbuffer(string, 0, &str_info->characters);
^
regex_2/_regex.c:18552:5: attention : implicit declaration of function ‘PyString_Check’ [-Wimplicit-function-declaration]
if (PyString_Check(string) || bytes == size)
^
regex_2/_regex.c: In function ‘as_string_index’:
regex_2/_regex.c:18981:5: attention : implicit declaration of function ‘PyInt_AsSsize_t’ [-Wimplicit-function-declaration]
value = PyInt_AsSsize_t(obj);
^
regex_2/_regex.c: In function ‘bytes_slice’:
regex_2/_regex.c:19045:5: attention : implicit declaration of function ‘PyString_GET_SIZE’ [-Wimplicit-function-declaration]
length = PyString_GET_SIZE(string);
^
regex_2/_regex.c:19049:5: attention : implicit declaration of function ‘PyString_AsString’ [-Wimplicit-function-declaration]
buffer = PyString_AsString(string);
^
regex_2/_regex.c:19049:12: attention : assignment makes pointer from integer without a cast [enabled by default]
buffer = PyString_AsString(string);
^
regex_2/_regex.c:19051:5: attention : implicit declaration of function ‘PyString_FromStringAndSize’ [-Wimplicit-function-declaration]
return PyString_FromStringAndSize(buffer + start, end - start);
^
regex_2/_regex.c:19051:5: attention : return makes pointer from integer without a cast [enabled by default]
regex_2/_regex.c: In function ‘match_get_group’:
regex_2/_regex.c:19468:5: attention : implicit declaration of function ‘PyInt_Check’ [-Wimplicit-function-declaration]
if (PyInt_Check(index) || PyLong_Check(index) || PyUnicode_Check(index) ||
^
regex_2/_regex.c: In function ‘join_list_info’:
regex_2/_regex.c:19935:13: attention : implicit declaration of function ‘PyString_FromString’ [-Wimplicit-function-declaration]
joiner = PyString_FromString("");
^
regex_2/_regex.c:19935:20: attention : assignment makes pointer from integer without a cast [enabled by default]
joiner = PyString_FromString("");
^
regex_2/_regex.c:19942:13: attention : implicit declaration of function ‘_PyString_Join’ [-Wimplicit-function-declaration]
result = _PyString_Join(joiner, join_info->list);
^
regex_2/_regex.c:19942:20: attention : assignment makes pointer from integer without a cast [enabled by default]
result = _PyString_Join(joiner, join_info->list);
^
regex_2/_regex.c:19959:9: attention : return makes pointer from integer without a cast [enabled by default]
return PyString_FromString("");
^
regex_2/_regex.c: Hors de toute fonction :
regex_2/_regex.c:20066:5: attention : accolades manquantes autour de l'initialisation [-Wmissing-braces]
PyObject_HEAD_INIT(NULL)
^
regex_2/_regex.c:20066:5: attention : (near initialization for ‘Capture_Type.ob_base.ob_base’) [-Wmissing-braces]
regex_2/_regex.c:20068:5: attention : initialization makes integer from pointer without a cast [enabled by default]
"_regex.Capture",
^
regex_2/_regex.c:20068:5: attention : (near initialization for ‘Capture_Type.tp_basicsize’) [enabled by default]
regex_2/_regex.c: In function ‘match_get_group_slice’:
regex_2/_regex.c:20263:7: attention : passing argument 1 of ‘PySlice_GetIndicesEx’ from incompatible pointer type [enabled by default]
(Py_ssize_t)self->group_count + 1, &start, &end, &step, &slice_length) <
^
In file included from /usr/include/python3.6m/Python.h:110:0,
from regex_2/_regex.c:48:
/usr/include/python3.6m/sliceobject.h:43:17: note: expected ‘struct PyObject *’ but argument is of type ‘struct PySliceObject *’
PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
^
regex_2/_regex.c: Hors de toute fonction :
regex_2/_regex.c:20658:5: attention : accolades manquantes autour de l'initialisation [-Wmissing-braces]
PyObject_HEAD_INIT(NULL)
^
regex_2/_regex.c:20658:5: attention : (near initialization for ‘Match_Type.ob_base.ob_base’) [-Wmissing-braces]
regex_2/_regex.c:20660:5: attention : initialization makes integer from pointer without a cast [enabled by default]
"_regex.Match",
^
regex_2/_regex.c:20660:5: attention : (near initialization for ‘Match_Type.tp_basicsize’) [enabled by default]
regex_2/_regex.c:21076:5: attention : accolades manquantes autour de l'initialisation [-Wmissing-braces]
PyObject_HEAD_INIT(NULL)
^
regex_2/_regex.c:21076:5: attention : (near initialization for ‘Scanner_Type.ob_base.ob_base’) [-Wmissing-braces]
regex_2/_regex.c:21078:5: attention : initialization makes integer from pointer without a cast [enabled by default]
"_regex.Scanner",
^
regex_2/_regex.c:21078:5: attention : (near initialization for ‘Scanner_Type.tp_basicsize’) [enabled by default]
regex_2/_regex.c: In function ‘index_to_integer’:
regex_2/_regex.c:21445:20: attention : assignment makes pointer from integer without a cast [enabled by default]
characters = PyString_AsString(item);
^
regex_2/_regex.c: Hors de toute fonction :
regex_2/_regex.c:21564:5: attention : accolades manquantes autour de l'initialisation [-Wmissing-braces]
PyObject_HEAD_INIT(NULL)
^
regex_2/_regex.c:21564:5: attention : (near initialization for ‘Splitter_Type.ob_base.ob_base’) [-Wmissing-braces]
regex_2/_regex.c:21566:5: attention : initialization makes integer from pointer without a cast [enabled by default]
"_regex.Splitter",
^
regex_2/_regex.c:21566:5: attention : (near initialization for ‘Splitter_Type.tp_basicsize’) [enabled by default]
regex_2/_regex.c: In function ‘get_sub_replacement’:
regex_2/_regex.c:21760:5: attention : implicit declaration of function ‘PyString_CheckExact’ [-Wimplicit-function-declaration]
if (PyUnicode_CheckExact(item) || PyString_CheckExact(item)) {
^
regex_2/_regex.c: In function ‘pack_code_list’:
regex_2/_regex.c:22834:22: attention : assignment makes pointer from integer without a cast [enabled by default]
packed_code_list = PyString_FromStringAndSize((const char *)packed, count);
^
regex_2/_regex.c: In function ‘unpack_code_list’:
regex_2/_regex.c:22853:19: attention : transtypage vers un pointeur depuis un entier de taille différente [-Wint-to-pointer-cast]
packed_data = (RE_UINT8*)PyString_AsString(packed);
^
regex_2/_regex.c: Hors de toute fonction :
regex_2/_regex.c:23137:5: attention : accolades manquantes autour de l'initialisation [-Wmissing-braces]
PyObject_HEAD_INIT(NULL)
^
regex_2/_regex.c:23137:5: attention : (near initialization for ‘Pattern_Type.ob_base.ob_base’) [-Wmissing-braces]
regex_2/_regex.c:23139:5: attention : initialization makes integer from pointer without a cast [enabled by default]
"_regex.Pattern",
^
regex_2/_regex.c:23139:5: attention : (near initialization for ‘Pattern_Type.tp_basicsize’) [enabled by default]
regex_2/_regex.c: In function ‘init_regex’:
regex_2/_regex.c:26597:29: erreur: ‘Py_TPFLAGS_HAVE_WEAKREFS’ undeclared (first use in this function)
Pattern_Type.tp_flags = Py_TPFLAGS_HAVE_WEAKREFS;
^
regex_2/_regex.c:26597:29: note: each undeclared identifier is reported only once for each function it appears in
regex_2/_regex.c:26641:9: attention : ‘return’ with no value, in function returning non-void [-Wreturn-type]
return;
^
regex_2/_regex.c:26643:9: attention : ‘return’ with no value, in function returning non-void [-Wreturn-type]
return;
^
regex_2/_regex.c:26645:9: attention : ‘return’ with no value, in function returning non-void [-Wreturn-type]
return;
^
regex_2/_regex.c:26647:9: attention : ‘return’ with no value, in function returning non-void [-Wreturn-type]
return;
^
regex_2/_regex.c:26649:9: attention : ‘return’ with no value, in function returning non-void [-Wreturn-type]
return;
^
regex_2/_regex.c:26653:5: attention : implicit declaration of function ‘Py_InitModule’ [-Wimplicit-function-declaration]
m = Py_InitModule("_regex", _functions);
^
regex_2/_regex.c:26653:7: attention : assignment makes pointer from integer without a cast [enabled by default]
m = Py_InitModule("_regex", _functions);
^
regex_2/_regex.c:26655:9: attention : ‘return’ with no value, in function returning non-void [-Wreturn-type]
return;
^
regex_2/_regex.c:26659:5: attention : implicit declaration of function ‘PyInt_FromLong’ [-Wimplicit-function-declaration]
x = PyInt_FromLong(RE_MAGIC);
^
regex_2/_regex.c:26659:7: attention : assignment makes pointer from integer without a cast [enabled by default]
x = PyInt_FromLong(RE_MAGIC);
^
regex_2/_regex.c:26665:7: attention : assignment makes pointer from integer without a cast [enabled by default]
x = PyInt_FromLong(sizeof(RE_CODE));
^
regex_2/_regex.c:26671:7: attention : assignment makes pointer from integer without a cast [enabled by default]
x = PyString_FromString(copyright);
^
regex_2/_regex.c:26680:9: attention : ‘return’ with no value, in function returning non-void [-Wreturn-type]
return;
^
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/usr/bin/python2 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-b8IfSq/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-25oOBE/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-b8IfSq/regex/
答案 0 :(得分:0)
大多数情况下,它已成为pip模块的旧版本。如果您是Windows用户,只需尝试在Windows powershell上使用python -m pip install --upgrade pip
命令对其进行更新。