在 Linux 服务器上安装 Levenshtein 库时,遇到了 “PyString_Type” 未声明的错误,以及一系列关于指针转换的警告,该如何解决?

在 linux 服务器上安装 levenshtein 库时,遇到了 “pystring_type” 未声明的错误,以及一系列关于指针转换的警告,该如何解决?

当在 linux 服务器上安装 levenshtein 时,出现以下错误:

/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 inif (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: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’:

以上就是在 Linux 服务器上安装 Levenshtein 库时,遇到了 “PyString_Type” 未声明的错误,以及一系列关于指针转换的警告,该如何解决?的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1351953.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2025年12月13日 16:24:43
下一篇 2025年12月13日 16:24:56

相关推荐

发表回复

登录后才能评论
关注微信