installing Mayavi with pip - no module named vtk

前端 未结 6 2021
耶瑟儿~
耶瑟儿~ 2020-12-24 11:48

I want to use Mayavi.

Situation

  • I use a MacBook Air, with OSX 10.7.3.
  • I use Python 2.7.2
  • I have virtualenv installed.
6条回答
  •  孤城傲影
    2020-12-24 12:39

    I'm on Debian but this should work for you as well

    I was stuck with installing vtk into a virtualenv, after hours of search with no results I did the following and it worked.

    1. install python-vtk from repositories systemwide

    2. copy vtk folder from /usr/lib/pymodules/python2.7 to /PATH/TO/YOUR/VIRTUALENV/lib/python2.7/site-packages

    In your case the system-wide python packages folder would probably be different but you can easily find it by firing up system python and entering the following:

    import vtk,sys
    print(sys.modules['vtk'])
    

    After this trick mayavi was succesfully installed into my virtualenv using pip install mayavi and pip install envisage.

    Edit: instead of copying it might better to just symlink the folder in step 2

提交回复
热议问题