ImportError: No module named vtkCommonPython

前端 未结 8 988
不思量自难忘°
不思量自难忘° 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:28

    I was having this same problem on MacOSX. So I started using vtk/bin/vtkpython instead of python. This allowed me to import vtk without any errors. I then imported vtkCommonCorePython explicitly and printed the location:

    $ /home/vtk/bin/vtkpython
    vtk version 6.2.0
    Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import vtkCommonCorePython 
    >>> print vtkCommonCorePython
    
    

    In the terminal, I then added the lib folder to my python virtual environment path:

    $ add2virtualenv /home/vtk/lib
    

    I don't know how this would translate to Windows, but I hope this helps!

提交回复
热议问题