我安装了状态模型及其对RHEL的所有依赖项。在导入状态模型时,它给了我如下信息:
(,ImportError('/home/lib/python2.7/site-packages/statsmodels/tsa/kalmanf/kalman_loglike.so:未定义符号:PyUnicodeUCS4 4_DecodeUTF8 8‘,)
看看其他页面,我重新编译python 2.7.15 (我有),用UCS-4作为unicode表示形式。但是,numpy抱怨说它正在寻找UCS-2!因此,状态模型需要UCS-4,但它的依赖关系numpy需要UCS-2。
有什么建议想出来吗?实际上,从最近一周开始,我一直在为这件事而挣扎。在状态模型中,它看起来像一个bug,但是它在Windows上与Anaconda一起工作得很好。所以,它只出现在RHEL机器上。
发布于 2019-02-22 10:39:16
在python中更新pyconfig-64.h之后,包括如下所示:
/* Define as the size of the unicode type. */
//#define Py_UNICODE_SIZE 4
#define Py_UNICODE_SIZE 2我发现了那个独角兽
/* FIXME: MvL's new implementation assumes that Py_UNICODE_SIZE is
properly set, but the default rules below doesn't set it. I'll
sort this out some other day -- fredrik@pythonware.com */在python中对这些文件以反映UCS2之后,重新编译用于UCS2的python,并在状态模型中更新大约17个不同的.c文件,如:
// #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4) (PyUnicode_AS_UNICODE(u)[i]))
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS2)(PyUnicode_AS_UNICODE(u)[i]))我终于成功地导入了状态模型和numpy。
我认为这需要在python和状态模型中修复。
https://stackoverflow.com/questions/53188814
复制相似问题