简体   繁体   中英

How can i import vtk in PyCharm

I'm trying to use VTK directly in PyCharm (vtkpython-7.0.0-Windows-64bit.exe)

After changing the interpreter references I still can not import vtk. When I want to load the vtkpython.exe directly i have an error.

error_screenshot

May be it is late but you can try this:

  1. Install Anaconda as the interpreter for python.
  2. Launch command-prompt or terminal and type for python 2.7

    conda create -n py27 python=2.7 anaconda

  3. Upon completion you can type for python 3.4

conda create -n py34 python=3.4 anaconda

  1. activate py27 or activate py34 (on windows)

source activate (on Mac)

to activate the terminal you want. Then you can install the vtk library on this terminal.

  1. Type conda install vtk and Proceed with yes to install vtk. Then you can use import vtk on Pycharm. This is just one of the methods.

I would like to thank this fantastic blogger PyScience where i learnt this from. Hope it helps!

If you want to use vtk in python, you don't need to set it as the interpreter. Your interpreter is still the python installation. vtk is connected to your python installation. If you want to use it, you have to import it with import vtk .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM