使用cmake生成PCL项目时报错解决方法

使用cmake编译PCL时报如下错误的解决方法

CMake Error at C:/Program Files (x86)/PCL 1.8.0/3rdParty/VTK/lib/cmake/vtk-7.0/Modules/vtkGUISupportQt.cmake:17 (find_package):
By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Qt5Widgets", but CMake did not find one.

Could not find a package configuration file provided by "Qt5Widgets" with
any of the following names:

Qt5WidgetsConfig.cmake
qt5widgets-config.cmake

Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
"Qt5Widgets_DIR" to a directory containing one of the above files. If
"Qt5Widgets" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
C:/Program Files (x86)/PCL 1.8.0/3rdParty/VTK/lib/cmake/vtk-7.0/vtkModuleAPI.cmake:45 (include)
C:/Program Files (x86)/PCL 1.8.0/3rdParty/VTK/lib/cmake/vtk-7.0/vtkModuleAPI.cmake:15 (vtk_module_load)
C:/Program Files (x86)/PCL 1.8.0/3rdParty/VTK/lib/cmake/vtk-7.0/vtkModuleAPI.cmake:132 (_vtk_module_config_recurse)
C:/Program Files (x86)/PCL 1.8.0/3rdParty/VTK/lib/cmake/vtk-7.0/VTKConfig.cmake:88 (vtk_module_config)
C:/Program Files (x86)/PCL 1.8.0/cmake/PCLConfig.cmake:487 (find_package)
C:/Program Files (x86)/PCL 1.8.0/cmake/PCLConfig.cmake:645 (find_VTK)
C:/Program Files (x86)/PCL 1.8.0/cmake/PCLConfig.cmake:832 (find_external_library)
CMakeLists.txt:7 (find_package)
 

Configuring incomplete, errors occurred!

 

解决方法1:修改CMakeLists.txt

在find_package前添加一行set(CMAKE_PREFIX_PATH "C:/Qt/Qt5.5.1/5.5/msvc2013")

解决方法2:修改系统变量

在系统变量中新加一项

变量名为CMAKE_PREFIX_PATH

变量值为C:/Qt/Qt5.5.1/5.5/msvc2013

运行结果:

参考:https://github.com/Cockatrice/Cockatrice/issues/205

### 如何在 PyCharm 中配置并安装 PCL 要在 PyCharm 中成功配置和使用 PCL(Point Cloud Library),需要完成以下几个方面的操作: #### 1. 安装 Visual Studio 和 CMake Visual Studio 是编译 PCL 的必要工具之一,而 CMake 则用于生成适合的构建文件。确保已按照推荐版本安装 Visual Studio 2017 或更高版本以及最新版 CMake[^2]。 #### 2. 下载并安装 PCL 库 从官方源获取 PCL 版本 (例如 PCL 1.8.1),解压后将其放置于指定目录。随后需设置环境变量 `PCL_ROOT` 并将路径加入系统的 PATH 变量中,以便后续调用动态链接库能正常工作[^1]。 #### 3. 配置 Python 环境 Python 环境建议基于 Anaconda 创建虚拟环境来管理依赖项。执行如下命令以安装必需的基础包 NumPy 和 Cython: ```bash conda install numpy conda install cython ``` 这一步骤有助于支持 python-pcl 封装所需的底层计算能力[^3]。 #### 4. 安装 Python-PCL 接口 通过 pip 工具可以方便地安装 python-pcl 包。然而需要注意的是,由于该模块可能未完全兼容最新的 Python 版本,在尝试之前确认所使用的解释器版本匹配文档中的测试条件——即 Python 3.7[^5]: ```bash pip install python-pcl ``` #### 5. 在 PyCharm 中集成 PCL 支持 打开 PyCharm 后创建新项目或者加载现有工程;接着转至 **File -> Settings -> Project:YourProjectName -> Python Interpreter** 页面选择对应的 Conda 虚拟环境作为默认解析引擎。最后验证是否可以在脚本里无误引入 pcl 模块: ```python import pcl print(pcl.__version__) ``` 如果一切设定恰当,则上述代码应返回当前安装好的 python-pcl 版本号而不抛异常[^4]。 #### 常见错误处理 当运行程序报关于 Dll 文件缺失的信息,请仔细检查是否有遗漏任何子组件的注册过程,并参照先前提到的手动调整方法补充完整路径映射关系表。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值