installing Mayavi with pip - no module named vtk

installing Mayavi with pip - no module named vtk

https://stackoverflow.com/questions/12182052/installing-mayavi-with-pip-no-module-named-vtk/12206868#12206868

I had the same problem when installing mayavi with python installed in pyenv, and I solved this problem by copy directory to /home/myname/.pyenv/versions/2.7.12/lib/python2.7/site-packages, below is my method:

  1. install vtk and python-vtk

    sudo apt-get install vtk6
    sudo apt-get install python-vtk
  2. try python -c "import vtk", if failed again, go to step 3

  3. the import error may caused by the loss of vtk package folder in your current python, so we should find the vtk folder and copy to your current python(most possible the python in pyenv shims directory)'s directory .

    the path of the vtk folder in my ubuntu is

    /usr/lib/python2.7/dist-packages/vtk

    just copy the vtk folder to your current python's /site-packages, e.g.

    cp -r /usr/lib/python2.7/dist-packages/vtk /home/myname/pyenv/versions/2.7.12/lib/python2.7/site-packages
    修改为: cp -r /usr/lib/pymodules/python2.7/vtk    /home/myname/.pyenv/versions/2.7.12/lib/python2.7/site-packages

  4. try python -c "import vtk" again.

  5. if no import error, just do

    pip install mayavi





你可能感兴趣的:(图像处理)