Win 10, x64, Python 3.6.6 & Python 2.7.12 (I tried the code in both), IPython 6.1.0
So far I am only able to run VTK projects using Visual Studio in C++ but would like the ease of using an interpreted language for development. So I installed the latest VTK via the Anaconda command prompt, conda install -c anaconda vtk
No problems everything updated & superseded as necessary. So I tried out a trial program from the Python examples only to get...
ModuleNotFoundError: No module named 'vtk'
I added C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Anaconda3_64\\pkgs\\vtk-8.1.0-py36he6bbf13_201\\Lib\\site-packages\\vtk
to my PYTHONPATH in Spyder but I still get the same error.
Any idea why IPython cant see the vtk library?
EDIT: VTK shows up as an installed library when I type conda list
at the command line
The following worked for me. Make sure to use the Anaconda Prompt .
# Create a new conda environment mypy3env and install vtk.
conda create -n "mypy3env" python=3
conda activate "mypy3env"
conda install -c conda-forge vtk
# Verify that python3 from Anaconda is used!
where python
python --version
# Test if vtk installation was successful
python -c "import vtk; print(vtk.vtkVersion.GetVTKVersion())"
See also the comments here to verify the Anaconda installation.
I tried to create a new environment and the vtk module works for Python version 3.6. When using a newer version of Python the vtk module cannot be loaded Exception has occurred: ModuleNotFoundError No module named 'vtkmodules.vtkCommonCore'
(I don't know why).
conda create --name MyEnv python=3.6
conda activate MyEnv
pip install 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.