LargeVis安装时python版本不对应导致“Py_InitModule”错误
从github上下载了LargeVis-master的可视化降维工具后,在linux上安装出现以下错误:
从网上查找了资料,
发现是python3中已经不用Py_initModule方法了,所以参考http://www.voidcn.com/article/p-azndxhwf-btn.html修改了LargeVismodule.cpp文件如下:
把这里注释掉
#PyMODINIT_FUNC initLargeVis()
#{
# printf("LargeVis successfully imported!\n");
# Py_InitModule("LargeVis", PyExtMethods);
#}
替换为:
static struct PyModuleDef cModPyDem =
{
PyModuleDef_HEAD_INIT,
"LargeVis", /* name of module */
"", /* module documentation, may be NULL */
-1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */
PyExtMethods
};
PyMODINIT_FUNC PyInit_Test(void)
{
return PyModule_Create(&cModPyDem);
}