首页 文章

VTK 7.1.0 Python 3.5.2出错

提问于
浏览
0

在Ubuntu 16.04上使用python 3.5.2构建VTK 7.1.0时出错 . 我搜了好几次,但我没弄明白如何解决它:/

我找到了一个关于它的对话,但他们没有找到解决方案 .

前段时间,我使用相同的python 3.5.2构建VTK并且它已经工作了,但不知何故它现在不起作用..

这个错误的一小部分是:

在/home/joaoponte/Downloads/VTK-git/vtk/Wrapping/Python/vtkPythonAppInit.cxx:29:0所包含的文件中:/ home / joaoponte / Downloads / VTK-git / vtk-build / Wrapping / Python / vtkpythonmodules .h:在函数'void vtkpythonmodulesPythonLoadAllPythonModules()'中:/ home /joaoponte / Download / VBK-git / vtk-build / Wrap /Python / vtkpythonmodules.h:125:68:错误:从'void()()无效转换'to'PyObject()(){aka _object(*)()}'[-fpermissive] PyImport_AppendInittab(namevtkCommonCore,initvtkCommonCorePython); ^来自/usr/include/python3.5m/Python.h:120:0的文件,来自/ home /joaoponte/Downloads/VTK-git/vtk/Utilities/Python/vtkPython.h:80,来自/ home / joaoponte / Downloads / VTK-git / vtk / Wrapping / Python / vtkPythonAppInit.cxx:18:/usr/include/python3.5m/import.h:109:17:注意:初始化'int PyImport_AppendInittab(const char *)的参数2 ,PyObject )())'

它对vtkpythonmodules.h文件中列出的所有模块重复 .

在vtkpythonmodules.h中我找到了这个(和其他人):

extern void initvtkCommonCorePython();

还有这个:

static char namevtkCommonCore[] = "vtkCommonCorePython";
PyImport_AppendInittab(namevtkCommonCore, initvtkCommonCorePython);

在Python.h中,我发现了这个:

PyAPI_FUNC(int) PyImport_AppendInittab(
    const char *name,           /* ASCII encoded string */
    PyObject* (*initfunc)(void) 
    );

我正在使用从git下载的最新VTK版本和Ubuntu 16.04中的默认python3,我使用ccmake进行配置 .

python可执行文件,include_dir和库使用python3.5m,但我也试过python3.5也失败了:(

有没有人有任何想法解决这个问题?它是python3的错误配置还是我系统中的其他任何东西?

编辑:我发现在python 2.7的import.h文件中,PyImport_AppendInittab似乎是“正确”(?)的...

PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc (void));

这是配置过程中的ccmake错误吗?我选择python3.5,但vtkpythonmodules.h是使用extern void 制作的 .

1 回答

  • 1

    我不是很熟悉在Ubuntu上安装VTK,但我们刚刚使用conda成功安装了VTK . 你可能会有更多的运气: conda install -c conda-forge vtk=7.1.0

相关问题