Ubuntu 20.04 ROS noetic 问题解决

系统: Ubuntu 20.04

安装ROS 版本:ROS noetic

问题描述如下:在进行catkin_make的过程中报错如下:

catkin_make
Base path: /home/wyb/catkin_ws
Source space: /home/wyb/catkin_ws/src
Build space: /home/wyb/catkin_ws/build
Devel space: /home/wyb/catkin_ws/devel
Install space: /home/wyb/catkin_ws/install
####
#### Running command: "cmake /home/wyb/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/wyb/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/wyb/catkin_ws/install -G Unix Makefiles" in "/home/wyb/catkin_ws/build"
####
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/wyb/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/noetic
-- This workspace overlays: /opt/ros/noetic
-- Found PythonInterp: /home/wyb/anaconda3/bin/python3 (found suitable version "3.8.8", minimum required is "3") 
-- Using PYTHON_EXECUTABLE: /home/wyb/anaconda3/bin/python3
-- Using Debian Python package layout
-- Found PY_em: /home/wyb/anaconda3/lib/python3.8/site-packages/em.py  
-- Using empy: /home/wyb/anaconda3/lib/python3.8/site-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/wyb/catkin_ws/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /home/wyb/anaconda3/bin/python3 (found version "3.8.8") 
-- Found Threads: TRUE  
-- Using Python nosetests: /usr/bin/nosetests3
ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  execute_process(/home/wyb/anaconda3/bin/python3
  "/opt/ros/noetic/share/catkin/cmake/parse_package_xml.py"
  "/opt/ros/noetic/share/catkin/cmake/../package.xml"
  "/home/wyb/catkin_ws/build/catkin/catkin_generated/version/package.cmake")
  returned error code 1
Call Stack (most recent call first):
  /opt/ros/noetic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process)
  /opt/ros/noetic/share/catkin/cmake/all.cmake:168 (_catkin_package_xml)
  /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
  CMakeLists.txt:58 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/wyb/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/wyb/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

经过研究可以发现,其报错内容是:

ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  execute_process(/home/wyb/anaconda3/bin/python3
  "/opt/ros/noetic/share/catkin/cmake/parse_package_xml.py"
  "/opt/ros/noetic/share/catkin/cmake/../package.xml"
  "/home/wyb/catkin_ws/build/catkin/catkin_generated/version/package.cmake")
  returned error code 1

参考了许多资料,以及其他博主的博客,但是,大家的报错部分虽然和我一样,但是在提示python使用版本部分却不大一样,大家的问题是使用的默认python版本是python3而要求版本是python2,而我默认使用的版本是python3要求也是python3,其提示代码如下:

-- Found PythonInterp: /home/wyb/anaconda3/bin/python3 (found suitable version "3.8.8", minimum required is "3") 

所以,如果是由于python版本的为问题导致了相同的错误,可以参考下此文章,链接

然后发现错误代码如下:

CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  execute_process(/home/wyb/anaconda3/bin/python3

可以看到,我的路径是在anaconda下的,而查看其他博主的路径并没有annaconda,怀疑是在安装annaconda后,对python区分的过程中出现了问题。所以再次对annaconda中的路径进行了编辑,可参考链接中anaconda的python区分部分,再次对python进行了区分后,将文章中的python3=XXX ,改为 python= XXX 随后执行代码如下:

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3

完成工作空间的创建。

你可能感兴趣的:(笔记,python,ide)