尝试在ROS中创建catkin工作区时遇到了CMake错误,因为它找不到PythonInterp。它找到了不合适的版本“ 1.4”,但至少需要2。但是,我已经为ros下载了更高版本的python。
这是我运行catkin_make时得到的
nasa@nasa-VirtualBox:~/catkin_ws$ catkin_make
Base path: /home/nasa/catkin_ws
Source space: /home/nasa/catkin_ws/src
Build space: /home/nasa/catkin_ws/build
Devel space: /home/nasa/catkin_ws/devel
Install space: /home/nasa/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/nasa/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/nasa/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/melodic
-- This workspace overlays: /opt/ros/melodic
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find PythonInterp: Found unsuitable version "1.4", but required
is at least "2" (found /home/nasa/catkin_ws/build/python3)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:376 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.10/Modules/FindPythonInterp.cmake:152 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
/opt/ros/melodic/share/catkin/cmake/python.cmake:4 (find_package)
/opt/ros/melodic/share/catkin/cmake/all.cmake:163 (include)
/opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:56 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/nasa/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/nasa/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:320: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
答案 0 :(得分:0)
解决方案可能是清理您的工作区。如此处the first link in google after searching for the error所示,问题出在CMakeCache.txt。根据您使用catkin build
还是catkin_make
,您可以在catkin工作区中运行catkin clean
或catkin_make clean
。只需删除工作空间中的devel和build文件夹也应适用于任何一种构建系统。
您可能还会在https://answers.ros.org/questions/
上获得有关ROS相关问题的更快答案如果清理工作区不能解决问题,请检查从终端python --version
报告的python版本。同样,如果您安装了新版本的python,并从同一终端尝试构建工作区,则该外壳中的相关环境路径可能尚未更新。运行exec bash
或启动一个新终端并尝试构建您的工作区。
答案 1 :(得分:0)
使用命令matchAll()
检查python的版本。
如果版本为2.7,则: