VTK 7.1.0 + Python 3.5.2出错。

时间:2022-08-24 04:23:47

I had an error during the built of VTK 7.1.0 using python 3.5.2 on Ubuntu 16.04. I searched several times and I didn't figured out how to resolve it :/

在VTK 7.1.0的构建过程中,在Ubuntu 16.04上使用python 3.5.2,我犯了一个错误。我找了好几次,都没找到解决办法:/。

I have found one conversation about it, but they didn't found a solution.

我找到了一个关于它的对话,但他们没有找到解决办法。

Some time ago, I built the VTK using the same python 3.5.2 and it has worked, but somehow it doesn't work now..

前一段时间,我使用相同的python 3.5.2构建了VTK,它已经工作了,但是现在它不工作了。

One small slice of this error is:

这个错误的一小部分是:

In file included from /home/joaoponte/Downloads/VTK-git/vtk/Wrapping/Python/vtkPythonAppInit.cxx:29:0: /home/joaoponte/Downloads/VTK-git/vtk-build/Wrapping/Python/vtkpythonmodules.h: In function ‘void vtkpythonmodulesPythonLoadAllPythonModules()’:

在文件中,包括/home/ joaoponte/downloads/vtk / vtk/wrapping/python/vtkpythonappinit。cxx:29:0:/home/joaoponte/Downloads/VTK-git/vtk-build/Wrapping/Python/vtkpythonmodules。h:在函数“void vtkpythonmodulesPythonLoadAllPythonModules()”中:

/home/joaoponte/Downloads/VTK-git/vtk-build/Wrapping/Python/vtkpythonmodules.h:125:68: error: invalid conversion from ‘void ()()’ to ‘PyObject ()() {aka _object (*)()}’ [-fpermissive]

/home/joaoponte/Downloads/VTK-git/vtk-build/Wrapping/Python/vtkpythonmodules。h:125:68:错误:从“void()()”到“PyObject()”()()()()()

PyImport_AppendInittab(namevtkCommonCore, initvtkCommonCorePython); ^ In file included from /usr/include/python3.5m/Python.h:120:0, from /home/joaoponte/Downloads/VTK-git/vtk/Utilities/Python/vtkPython.h:80, from /home/joaoponte/Downloads/VTK-git/vtk/Wrapping/Python/vtkPythonAppInit.cxx:18: /usr/include/python3.5m/import.h:109:17: note: initializing argument 2 of ‘int PyImport_AppendInittab(const char*, PyObject* (*)())’

PyImport_AppendInittab(namevtkCommonCore initvtkCommonCorePython);在文件包括从/usr/include/python3.5m/Python. ^h:从/home/joaoponte/Downloads/VTK-git/vtk/Utilities/Python/vtkPython. 120:0从/home/joaoponte/Downloads/VTK-git/vtk/Wrapping/Python/vtkPythonAppInit h:80。cxx:18:/usr/include/python3.5m/import.h:109:17:注意:初始化PyImport_AppendInittab(const char*, PyObject* (*)())

It repeats for all modules listed in the vtkpythonmodules.h file.

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

In the vtkpythonmodules.h I found this (and others):

vtkpythonmodules。我发现这个(和其他):

extern void initvtkCommonCorePython();

and this:

这:

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

And in the Python.h, I found this:

和Python。h时,我发现:

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

I'm using the latest VTK version downloaded from git and the default python3 from Ubuntu 16.04 and I used the ccmake to configure.

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

the python executable, include_dir and library was using the python3.5m but I tried python3.5 as well and failed too :(

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

Does anyone have any idea to resolve this? Is it a misconfiguration of python3 or whatever else in my system?

有谁有办法解决这个问题吗?它是python3的错误配置还是我系统中的其他东西?

EDIT: I've found that in the import.h file from python 2.7, the PyImport_AppendInittab seems to be the "right" (?) ones...

编辑:我已经在导入中找到了。来自python 2.7的h文件,PyImport_AppendInittab似乎是“正确的”(?)

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

Was that an ccmake error during the configuration process? I choose python3.5, but the vtkpythonmodules.h was made using extern void.

在配置过程中是否存在ccmake错误?我选择了python3.5,但是vtkpythonmodule。h是用外部空隙做的。

1 个解决方案

#1


0  

I'm not really familiar with installing VTK on Ubuntu, but we just successfully installed VTK using conda. You might have more luck with that: conda install -c conda-forge vtk=7.1.0

我不太熟悉在Ubuntu上安装VTK,但是我们只是成功地安装了VTK。您可能会有更多的幸运:conda安装-c conda-forge vtk=7.1.0。

#1


0  

I'm not really familiar with installing VTK on Ubuntu, but we just successfully installed VTK using conda. You might have more luck with that: conda install -c conda-forge vtk=7.1.0

我不太熟悉在Ubuntu上安装VTK,但是我们只是成功地安装了VTK。您可能会有更多的幸运:conda安装-c conda-forge vtk=7.1.0。