Ubuntu14.04安装VTK

时间:2024-04-02 16:42:45

原文链接:https://blog.csdn.net/jiangjiang_jian/article/details/80104603

VTK是一个基于面向对象的开源三维绘图软件包,安装过程并不复杂,可由多种方法安装,如果想要安装自己想要的版本,编译安装是最好的方式,简单的cmake就可以编译安装。此处也简单说一下非编译安装:

一、非编译安装方法

1)sudo pip install vtk 将会安装最新版vtk

2)sudo apt-get install python-vtk 同上

二、编译安装vtk

1)下载vtk包(.zip或.tar.gz): 下载vtk

2)解压在VTK目录下

sudo unzip VTK-6.3.0.zip

3)准备编译文件目录

mkdir VTK_BULD

cd VTK_BULD

ccmake ../VTK/VTK-6.3.0

4)编译过程
Ubuntu14.04安装VTK
如果没有编译过的会提示没有缓存,可以按c进行配置,之后就会出现这个界面,用上下建选择条目,BUILD_SHARE_LIBS 选择ON ,VTK_Group_Qt选择 On就可以了,其它的可以不做更改,再次按c进行配置确认,按g保存配置。

5)执行make:过程漫长

sudo make

6)安装

sudo make -j 8 install

7)添加环境变量 .bash_profile, .bashrc, or .profile file

LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/vtk-6.3"
PYTHONPATH="$PYTHONPATH:/usr/local/lib/vtk-6.3"

安装完成

注意:如果在cmake的时候发现有以下错误:

CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:26
 (find_package):
   Could not find a package configuration file provided by "Qt5Designer" with
   any of the following names:

     Qt5DesignerConfig.cmake
     qt5designer-config.cmake

   Add the installation prefix of "Qt5Designer" to CMAKE_PREFIX_PATH or set
   "Qt5Designer_DIR" to a directory containing one of the above files.  If
   "Qt5Designer" provides a separate development package or SDK, be sure it
   has been installed.
   Call Stack (most recent call first):
   GUISupport/Qt/CMakeLists.txt:113 (find_package)

这就意思就是要添加Qt5Designer的安装路径的前缀到CMAKE_PREFIX_PATH
解决方式:
export CMAKE_PREFIX_PATH=/home/hdh/Qt5.9.1/5.9.1/gcc_64/lib/cmake/