在liunx 安装Levenshtein错误

2021-02-01 13:44发布

问题:

在windows本地电脑上都安装起了,用whl方式,克服VC++问题。
但上liunx服务器有不行了,具体错误如下:

Collecting python-Levenshtein0.10.2
Downloading python-Levenshtein-0.10.2.tar.gz (45 kB)
|████████████████████████████████| 45 kB 67 kB/s
Requirement already satisfied: setuptools in /yuwei/anaconda3/lib/python3.7/site-packages (from python-Levenshtein
0.10.2) (45.2.0.post20200210)
Building wheels for collected packages: python-Levenshtein
Building wheel for python-Levenshtein (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /yuwei/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_97ezszt/python-Levenshtein/setup.py'"'"'; file='"'"'/tmp/pip-install-_97ezszt/python-Levenshtein/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-cv8p0664
cwd: /tmp/pip-install-_97ezszt/python-Levenshtein/
Complete output (335 lines):
running bdist_wheel
running build
running build_ext
building 'Levenshtein' extension
creating build
creating build/temp.linux-x86_64-3.7
gcc -pthread -B /yuwei/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/yuwei/anaconda3/include/python3.7m -c Levenshtein.c -o build/temp.linux-x86_64-3.7/Levenshtein.o
In file included from /yuwei/anaconda3/include/python3.7m/pytime.h:6:0,
from /yuwei/anaconda3/include/python3.7m/Python.h:87,
from Levenshtein.c:99:
Levenshtein.c: In function ‘levenshtein_common’:
Levenshtein.c:666:33: error: ‘PyString_Type’ undeclared (first use in this function)
if (PyObject_TypeCheck(arg1, &PyString_Type)
^
/yuwei/anaconda3/include/python3.7m/object.h:487:22: note: in definition of macro ‘PyObject_TypeCheck’
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
^
Levenshtein.c:666:33: note: each undeclared identifier is reported only once for each function it appears in
if (PyObject_TypeCheck(arg1, &PyString_Type)
^
/yuwei/anaconda3/include/python3.7m/object.h:487:22: note: in definition of macro ‘PyObject_TypeCheck’
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
^
Levenshtein.c:670:5: warning: implicit declaration of function ‘PyString_GET_SIZE’ [-Wimplicit-function-declaration]
len1 = PyString_GET_SIZE(arg1);
^
Levenshtein.c:673:5: warning: implicit declaration of function ‘PyString_AS_STRING’ [-Wimplicit-function-declaration]
string1 = PyString_AS_STRING(arg1);
^
Levenshtein.c:673:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string1 = PyString_AS_STRING(arg1);
^
Levenshtein.c:674:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string2 = PyString_AS_STRING(arg2);
^
Levenshtein.c: In function ‘distance_py’:
Levenshtein.c:718:3: warning: implicit declaration of function ‘PyInt_FromLong’ [-Wimplicit-function-declaration]
return PyInt_FromLong((long)ldist);
^
Levenshtein.c:718:3: warning: return makes pointer from integer without a cast [enabled by default]
In file included from /yuwei/anaconda3/include/python3.7m/pytime.h:6:0,
from /yuwei/anaconda3/include/python3.7m/Python.h:87,
from Levenshtein.c:99:
Levenshtein.c: In function ‘hamming_py’:
Levenshtein.c:747:33: error: ‘PyString_Type’ undeclared (first use in this function)
if (PyObject_TypeCheck(arg1, &PyString_Type)
^
/yuwei/anaconda3/include/python3.7m/object.h:487:22: note: in definition of macro ‘PyObject_TypeCheck’
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
^
Levenshtein.c:758:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string1 = PyString_AS_STRING(arg1);
^
Levenshtein.c:759:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string2 = PyString_AS_STRING(arg2);
^
Levenshtein.c:761:5: warning: return makes pointer from integer without a cast [enabled by default]
return PyInt_FromLong(dist);
^
Levenshtein.c:777:5: warning: return makes pointer from integer without a cast [enabled by default]
return PyInt_FromLong(dist);
^
In file included from /yuwei/anaconda3/include/python3.7m/pytime.h:6:0,
from /yuwei/anaconda3/include/python3.7m/Python.h:87,
from Levenshtein.c:99:
Levenshtein.c: In function ‘jaro_py’:
Levenshtein.c:796:33: error: ‘PyString_Type’ undeclared (first use in this function)
if (PyObject_TypeCheck(arg1, &PyString_Type)
^
/yuwei/anaconda3/include/python3.7m/object.h:487:22: note: in definition of macro ‘PyObject_TypeCheck’
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
^
Levenshtein.c:802:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string1 = PyString_AS_STRING(arg1);
^
Levenshtein.c:803:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string2 = PyString_AS_STRING(arg2);
^
In file included from /yuwei/anaconda3/include/python3.7m/pytime.h:6:0,
from /yuwei/anaconda3/include/python3.7m/Python.h:87,
from Levenshtein.c:99:
Levenshtein.c: In function ‘jaro_winkler_py’:
Levenshtein.c:846:33: error: ‘PyString_Type’ undeclared (first use in this function)
if (PyObject_TypeCheck(arg1, &PyString_Type)
^
/yuwei/anaconda3/include/python3.7m/object.h:487:22: note: in definition of macro ‘PyObject_TypeCheck’
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
^
Levenshtein.c:852:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string1 = PyString_AS_STRING(arg1);
^
Levenshtein.c:853:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string2 = PyString_AS_STRING(arg2);
^
Levenshtein.c: In function ‘median_common’:
Levenshtein.c:954:7: warning: implicit declaration of function ‘PyString_FromStringAndSize’ [-Wimplicit-function-declaration]
result = PyString_FromStringAndSize(medstr, len);
^
Levenshtein.c:954:14: warning: assignment makes pointer from integer without a cast [enabled by default]
result = PyString_FromStringAndSize(medstr, len);
^
In file included from /yuwei/anaconda3/include/python3.7m/pytime.h:6:0,
from /yuwei/anaconda3/include/python3.7m/Python.h:87,
from Levenshtein.c:99:
Levenshtein.c: In function ‘median_improve_common’:
Levenshtein.c:993:33: error: ‘PyString_Type’ undeclared (first use in this function)
if (PyObject_TypeCheck(arg1, &PyString_Type))
^
/yuwei/anaconda3/include/python3.7m/object.h:487:22: note: in definition of macro ‘PyObject_TypeCheck’
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
^
Levenshtein.c:1033:19: warning: initialization makes pointer from integer without a cast [enabled by default]
lev_byte *s = PyString_AS_STRING(arg1);
^
Levenshtein.c:1039:14: warning: assignment makes pointer from integer without a cast [enabled by default]
result = PyString_FromStringAndSize(medstr, len);
^
Levenshtein.c: In function ‘extract_weightlist’:
Levenshtein.c:1077:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (PySequence_Fast_GET_SIZE(wlist) != n) {
^
In file included from /yuwei/anaconda3/include/python3.7m/pytime.h:6:0,
from /yuwei/anaconda3/include/python3.7m/Python.h:87,
from Levenshtein.c:99:
Levenshtein.c: In function ‘extract_stringlist’:
Levenshtein.c:1145:34: error: ‘PyString_Type’ undeclared (first use in this function)
if (PyObject_TypeCheck(first, &PyString_Type)) {
^
/yuwei/anaconda3/include/python3.7m/object.h:487:22: note: in definition of macro ‘PyObject_TypeCheck’
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
^
Levenshtein.c:1163:16: warning: assignment makes pointer from integer without a cast [enabled by default]
strings[0] = PyString_AS_STRING(first);
^
Levenshtein.c:1175:18: warning: assignment makes pointer from integer without a cast [enabled by default]
strings[i] = PyString_AS_STRING(item);
^
Levenshtein.c: In function ‘string_to_edittype’:
Levenshtein.c:1350:3: warning: implicit declaration of function ‘PyString_Check’ [-Wimplicit-function-declaration]
if (!PyString_Check(string))
^
Levenshtein.c:1353:5: warning: assignment makes pointer from integer without a cast [enabled by default]
s = PyString_AS_STRING(string);
^
Levenshtein.c: In function ‘extract_editops’:
Levenshtein.c:1391:5: warning: implicit declaration of function ‘PyInt_Check’ [-Wimplicit-function-declaration]
if (!PyInt_Check(item)) {
^
Levenshtein.c:1395:5: warning: implicit declaration of function ‘PyInt_AS_LONG’ [-Wimplicit-function-declaration]
ops[i].spos = (size_t)PyInt_AS_LONG(item);
^
In file included from /yuwei/anaconda3/include/python3.7m/Python.h:107:0,
from Levenshtein.c:99:
Levenshtein.c: In function ‘editops_to_tuple_list’:
/yuwei/anaconda3/include/python3.7m/tupleobject.h:62:73: warning: assignment makes pointer from integer without a cast [enabled by default]

define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

                                                                       ^

Levenshtein.c:1472:5: note: in expansion of macro ‘PyTuple_SET_ITEM’
PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong((long)ops->spos));
^
/yuwei/anaconda3/include/python3.7m/tupleobject.h:62:73: warning: assignment makes pointer from integer without a cast [enabled by default]

define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

                                                                       ^

Levenshtein.c:1473:5: note: in expansion of macro ‘PyTuple_SET_ITEM’
PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong((long)ops->dpos));
^
Levenshtein.c: In function ‘matching_blocks_to_tuple_list’:
/yuwei/anaconda3/include/python3.7m/tupleobject.h:62:73: warning: assignment makes pointer from integer without a cast [enabled by default]

define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

                                                                       ^

Levenshtein.c:1490:5: note: in expansion of macro ‘PyTuple_SET_ITEM’
PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)mblocks->spos));
^
/yuwei/anaconda3/include/python3.7m/tupleobject.h:62:73: warning: assignment makes pointer from integer without a cast [enabled by default]

define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

                                                                       ^

Levenshtein.c:1491:5: note: in expansion of macro ‘PyTuple_SET_ITEM’
PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong((long)mblocks->dpos));
^
/yuwei/anaconda3/include/python3.7m/tupleobject.h:62:73: warning: assignment makes pointer from integer without a cast [enabled by default]

define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

                                                                       ^

Levenshtein.c:1492:5: note: in expansion of macro ‘PyTuple_SET_ITEM’
PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong((long)mblocks->len));
^
/yuwei/anaconda3/include/python3.7m/tupleobject.h:62:73: warning: assignment makes pointer from integer without a cast [enabled by default]

define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

                                                                       ^

Levenshtein.c:1496:3: note: in expansion of macro ‘PyTuple_SET_ITEM’
PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((long)len1));
^
/yuwei/anaconda3/include/python3.7m/tupleobject.h:62:73: warning: assignment makes pointer from integer without a cast [enabled by default]

define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

                                                                       ^

Levenshtein.c:1497:3: note: in expansion of macro ‘PyTuple_SET_ITEM’
PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong((long)len2));
^
/yuwei/anaconda3/include/python3.7m/tupleobject.h:62:73: warning: assignment makes pointer from integer without a cast [enabled by default]

define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

                                                                       ^

Levenshtein.c:1498:3: note: in expansion of macro ‘PyTuple_SET_ITEM’
PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong((long)0));
^
In file included from /yuwei/anaconda3/include/python3.7m/pytime.h:6:0,
from /yuwei/anaconda3/include/python3.7m/Python.h:87,
from Levenshtein.c:99:
Levenshtein.c: In function ‘editops_py’:
Levenshtein.c:1586:33: error: ‘PyString_Type’ undeclared (first use in this function)
if (PyObject_TypeCheck(arg1, &PyString_Type)
^
/yuwei/anaconda3/include/python3.7m/object.h:487:22: note: in definition of macro ‘PyObject_TypeCheck’
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
^
Levenshtein.c:1592:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string1 = PyString_AS_STRING(arg1);
^
Levenshtein.c:1593:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string2 = PyString_AS_STRING(arg2);
^
In file included from /yuwei/anaconda3/include/python3.7m/Python.h:107:0,
from Levenshtein.c:99:
Levenshtein.c: In function ‘opcodes_to_tuple_list’:
/yuwei/anaconda3/include/python3.7m/tupleobject.h:62:73: warning: assignment makes pointer from integer without a cast [enabled by default]

define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

                                                                       ^

Levenshtein.c:1630:5: note: in expansion of macro ‘PyTuple_SET_ITEM’
PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong((long)bops->sbeg));
^
/yuwei/anaconda3/include/python3.7m/tupleobject.h:62:73: warning: assignment makes pointer from integer without a cast [enabled by default]

define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

                                                                       ^

Levenshtein.c:1631:5: note: in expansion of macro ‘PyTuple_SET_ITEM’
PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong((long)bops->send));
^
/yuwei/anaconda3/include/python3.7m/tupleobject.h:62:73: warning: assignment makes pointer from integer without a cast [enabled by default]

define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

                                                                       ^

Levenshtein.c:1632:5: note: in expansion of macro ‘PyTuple_SET_ITEM’
PyTuple_SET_ITEM(tuple, 3, PyInt_FromLong((long)bops->dbeg));
^
/yuwei/anaconda3/include/python3.7m/tupleobject.h:62:73: warning: assignment makes pointer from integer without a cast [enabled by default]

define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

                                                                       ^

Levenshtein.c:1633:5: note: in expansion of macro ‘PyTuple_SET_ITEM’
PyTuple_SET_ITEM(tuple, 4, PyInt_FromLong((long)bops->dend));
^
In file included from /yuwei/anaconda3/include/python3.7m/pytime.h:6:0,
from /yuwei/anaconda3/include/python3.7m/Python.h:87,
from Levenshtein.c:99:
Levenshtein.c: In function ‘opcodes_py’:
Levenshtein.c:1704:33: error: ‘PyString_Type’ undeclared (first use in this function)
if (PyObject_TypeCheck(arg1, &PyString_Type)
^
/yuwei/anaconda3/include/python3.7m/object.h:487:22: note: in definition of macro ‘PyObject_TypeCheck’
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
^
Levenshtein.c:1710:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string1 = PyString_AS_STRING(arg1);
^
Levenshtein.c:1711:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string2 = PyString_AS_STRING(arg2);
^
In file included from /yuwei/anaconda3/include/python3.7m/pytime.h:6:0,
from /yuwei/anaconda3/include/python3.7m/Python.h:87,
from Levenshtein.c:99:
Levenshtein.c: In function ‘apply_edit_py’:
Levenshtein.c:1795:33: error: ‘PyString_Type’ undeclared (first use in this function)
if (PyObject_TypeCheck(arg1, &PyString_Type)
^
/yuwei/anaconda3/include/python3.7m/object.h:487:22: note: in definition of macro ‘PyObject_TypeCheck’
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
^
Levenshtein.c:1805:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string1 = PyString_AS_STRING(arg1);
^
Levenshtein.c:1806:13: warning: assignment makes pointer from integer without a cast [enabled by default]
string2 = PyString_AS_STRING(arg2);
^
Levenshtein.c:1820:14: warning: assignment makes pointer from integer without a cast [enabled by default]
result = PyString_FromStringAndSize(s, len);
^
Levenshtein.c:1836:14: warning: assignment makes pointer from integer without a cast [enabled by default]
result = PyString_FromStringAndSize(s, len);
^
Levenshtein.c: In function ‘subtract_edit_py’:
Levenshtein.c:2002:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (!orem && nr == -1) {
^
Levenshtein.c: In function ‘initLevenshtein’:
Levenshtein.c:2029:3: warning: implicit declaration of function ‘Py_InitModule3’ [-Wimplicit-function-declaration]
module = Py_InitModule3("Levenshtein", methods, Levenshtein_DESC);
^
Levenshtein.c:2029:10: warning: assignment makes pointer from integer without a cast [enabled by default]
module = Py_InitModule3("Levenshtein", methods, Levenshtein_DESC);
^
Levenshtein.c:2035:7: warning: implicit declaration of function ‘PyString_InternFromString’ [-Wimplicit-function-declaration]
= PyString_InternFromString(opcode_names[i].cstring);
^
Levenshtein.c:2035:7: warning: assignment makes pointer from integer without a cast [enabled by default]
Levenshtein.c:2026:13: warning: variable ‘module’ set but not used [-Wunused-but-set-variable]
PyObject *module;
^
Levenshtein.c: At top level:
Levenshtein.c:6563:1: warning: ‘lev_editops_total_cost’ defined but not used [-Wunused-function]
lev_editops_total_cost(size_t n,
^
Levenshtein.c:6633:1: warning: ‘lev_opcodes_total_cost’ defined but not used [-Wunused-function]
lev_opcodes_total_cost(size_t nb,
^
Levenshtein.c:6588:1: warning: ‘lev_editops_normalize’ defined but not used [-Wunused-function]
lev_editops_normalize(size_t n,
^
Levenshtein.c:2304:1: warning: ‘lev_edit_distance_sod’ defined but not used [-Wunused-function]
lev_edit_distance_sod(size_t len, const lev_byte *string,
^
Levenshtein.c:2483:1: warning: ‘lev_u_edit_distance_sod’ defined but not used [-Wunused-function]
lev_u_edit_distance_sod(size_t len, const lev_wchar *string,
^
Levenshtein.c: In function ‘jaro_winkler_py’:
Levenshtein.c:875:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
Levenshtein.c: In function ‘jaro_py’:
Levenshtein.c:821:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
Levenshtein.c: In function ‘hamming_py’:
Levenshtein.c:784:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
Levenshtein.c: In function ‘levenshtein_common’:
Levenshtein.c:707:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
error: command 'gcc' failed with exit status 1

ERROR: Failed building wheel for python-Levenshtein

有没有知道的呀

回答1:

缺少依赖
我觉得你gcc都没装

yum install gcc