ImportError: No module named vtkCommonPython

前端 未结 8 973
不思量自难忘°
不思量自难忘° 2020-12-06 09:34

I am trying to install Python with VTK on my computer, but when I want to import VTK, I get an error:

import vtk 
Traceback (most recent call last): 
 File          


        
相关标签:
8条回答
  • 2020-12-06 10:39

    Assuming you used the suggested paths in the instructions, add the following line to your bashrc:

    export PYTHONPATH=$HOME/projects/VTK-build/lib:$HOME/projects/VTK-build/Wrapping/Python:$PYTHONPATH
    

    If the problem occurs when using sudo, e.g.

    sudo yum install mayavi
    

    you probably need to resolve this issue. Add the following line to the bashrc:

    alias sudo=’sudo env PYTHONPATH=$PYTHONPATH’
    

    Full instructions

    0 讨论(0)
  • 2020-12-06 10:40

    You need to add the folder of vtkCommonPython.pyd also to the system path (like if it was a dll). See also http://www.vtk.org/Wiki/VTK/Tutorials/PythonEnvironmentSetup

    0 讨论(0)
提交回复
热议问题