linux - Ubuntu VTK for Python compiled from source -
i compiled vtk 7.0 (6.3 has same effect) on cmake following params:
-library_output_path:path="" -cmake_install_prefix:path="/usr/local" -vtk_enable_vtkpython:bool="1" -module_vtkpython:bool="1" - -vtk_group_qt:bool="1" -cmake_objcopy:filepath="/usr/bin/objcopy" -vtk_rendering_backend:string="opengl2" -vtk_install_python_module_dir:path="/usr/local/lib/python2.7/site-packages" -dvtk_egl_device_index:string="0" -vtk_wrap_python:bool="1" -module_vtkguisupportqtopengl:bool="1"
now can find binary "vtkpython" @ /usr/local/bin .
good news:
i allowed enter python shell command "vtkpython" out of directory (/usr/local/bin) needed vtk bindings.
markovich@markovich-desktop:~$ cd /usr/local/bin/ markovich@markovich-desktop:/usr/local/bin$ vtkpython vtk version 7.0.0 python 2.7.10 (default, oct 14 2015, 16:09:02) [gcc 5.2.1 20151010] on linux2 type "help", "copyright", "credits" or "license" more information. >>> import vtk >>> vtk <module 'vtk' '/usr/local/lib/python2.7/site-packages/vtk/__init__.py'> >>>
thats bit irritating because expecting run default python environement , vtk bindings available.
so bad news:
if type python
in shell or vtkpython
location on system shell says "no modulen named vtk found" on calling import vtk
.
markovich@markovich-desktop:~$ vtkpython vtk version 7.0.0 python 2.7.10 (default, oct 14 2015, 16:09:02) [gcc 5.2.1 20151010] on linux2 type "help", "copyright", "credits" or "license" more information. >>> import vtk traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: no module named vtk >>>
question 1: maybe missed in make configuration ? question 2: if take actual status (which somehow working): possible integrate "vtkpython" bindings in default python environment? if not totally wrong. binding correctly loaded out of python2.7 path can see in terminal:
<module 'vtk' '/usr/local/lib/python2.7/site-packages/vtk/__init__.py'>
so how can add module loaded in python environment ? oo
thanks in advance!!
since loading vtkpython
shows have module available somewhere on system, should able add location of vtk module pythonpath variable.
find vtk module installed (try /usr/local/lib/python2.7/site-packages
, should see /vtk
folder). if you're unsure, try find in vtkpython
with
import vtk import imp imp.find_module('vtk')
you can check paths stored in pythonpath entering in terminal:
echo $pythonpath
(in install, empty default.)
then can add vtk folder location pythonpath in terminal:
export pythonpath=$pythonpath:/usr/local/lib/python2.7/site-packages
check if vtk availabe:
$ python >>> import vtk
if works, can add export...
line above ~/.bashrc
or ~/.profile
(as appropriate per distro installation) permanently load option in pythonpath.
Comments
Post a Comment