我最近将我的系统更新到了 Ubunutu 20.04,而我的 python 现在是 3.8.从那以后我所有的 import vtk 行都不起作用,
I recently updated my system to Ubunutu 20.04, and my python is now 3.8. Since then all my import vtk lines don't work,
ModuleNotFoundError: No module named 'vtk'我已经尝试了 apt-get python-vtk、pip3 install vtk 和几乎所有标准的终端安装命令.毫无疑问,他们都无法找到包裹.我一直在网上寻找解决这个问题的方法,但没有成功.
I have tried apt-get python-vtk, pip3 install vtk and pretty much all the standard terminal install commands. Without fail they all are unable to locate the package. I have been searching for ways to sort this out all over the net, but without success.
我熟悉从源代码构建 Kitware(Cmake 和 Paraivew)的东西,所以我这样做了:
I am familiar with building Kitware (Cmake and Paraivew) stuff from source so I did so:
git clone github/Kitware/VTK.git mkdir VTK/build cd VTK/build ccmake .. make make install一些相关的 cmake 选项是 BUILD_SHARED_LIBS=ON、CMAKE_BUILD_TYPE=Release、CMAKE_INSTALL_PREFIX=/usr/local、python3_EXECUTABLE=/usr/bin/python3.8、VTK_WRAP_PYTHON=ON、Python3_INCLUDE_DIR=/usr/include/python3.8、Python3_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.8.so 和 VTK_PYTHON_OPTIONAL_LINK=ON.
some relevant cmake options are BUILD_SHARED_LIBS=ON, CMAKE_BUILD_TYPE=Release, CMAKE_INSTALL_PREFIX=/usr/local, python3_EXECUTABLE=/usr/bin/python3.8, VTK_WRAP_PYTHON=ON, Python3_INCLUDE_DIR=/usr/include/python3.8, Python3_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.8.so, and VTK_PYTHON_OPTIONAL_LINK=ON.
我能够构建它,并且我假设我应该打开python wrapping.安装后,我发现仍然无法运行 python 文件,仍然出现与上述相同的错误.我觉得我只需要告诉 python 去哪里获取 vtk 模块,这是正确的吗?如果是这样,它在哪里,它的名字是什么,我如何制作 python 链接到它?还是我错过了什么或做了一些非常愚蠢的事情?
I am able to build it, and I assume I am supposed to turn on python wrapping. Once installed I find I am still unable to get python files to run, still get the same error as mentioned above. I feel like I just need to tell python where to go to get the vtk module, is this correct? If so, where is it and what is its name and how do my make python link to it? Or am I missing something or doing something really stupid?
如果有一种 apt-get 或 pip3 install 这样做的方式,那会更好,但我想我已经用尽了谷歌搜索找到的所有尝试.
If there is an apt-get or pip3 install way of doing this that would be preferable, but I think I have exhausted all attempts found by google searching.
提前致谢.
推荐答案使用 apt-get install python3-vtk7 (packages.ubuntu/focal/python3-vtk7) 适用于 ubuntu 20.04.
Use apt-get install python3-vtk7 (packages.ubuntu/focal/python3-vtk7) for ubuntu 20.04.
python-vtk 包仅适用于 ubuntu 16.04 (packages.ubuntu/xenial/python-vtk).
The python-vtk package is only available for ubuntu 16.04 (packages.ubuntu/xenial/python-vtk).
python 3.8 没有 vtk pip 轮子,尽管它们确实存在于旧版本的 python 中.请参阅 pypi/project/vtk/#files
There are no vtk pip wheels for python 3.8, though they do exist for older versions of python. See pypi/project/vtk/#files
更多推荐
使用 python3.8 和 Ubuntu 20.04 设置 VTK
发布评论