【Bug_catkin_make】catkin_make时出现No module named ‘catkin_pkg‘

错误如下:

zth@SugoAsurada:~/catkin_ws$ catkin_make
Base path: /home/zth/catkin_ws
Source space: /home/zth/catkin_ws/src
Build space: /home/zth/catkin_ws/build
Devel space: /home/zth/catkin_ws/devel
Install space: /home/zth/catkin_ws/install
####
#### Running command: "cmake /home/zth/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/zth/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/zth/catkin_ws/install -G Unix Makefiles" in "/home/zth/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/zth/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/melodic
-- This workspace overlays: /opt/ros/melodic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.9", minimum required is "2") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/zth/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.6.9") 
-- Using Python nosetests: /usr/bin/nosetests
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/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  execute_process(/usr/bin/python3
  "/opt/ros/melodic/share/catkin/cmake/parse_package_xml.py"
  "/opt/ros/melodic/share/catkin/cmake/../package.xml"
  "/home/zth/catkin_ws/build/catkin/catkin_generated/version/package.cmake")
  returned error code 1
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process)
  /opt/ros/melodic/share/catkin/cmake/all.cmake:168 (_catkin_package_xml)
  /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:20 (include)
  CMakeLists.txt:58 (find_package)


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

解决方案

第一步:安装catkin_pkg

pip install --user catkin_pkg
pip install --user rosdep rosinstall_generator wstool rosinstall six vcstools
pip install --user pydot

第二步:配置环境变量

sudo gedit ~/.bashrc
  • 打开文件,在文件末尾添加
export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages
  • 关闭文件
  • 终端运行
source ~/.bashrc

参考博客

[1] https://blog.csdn.net/qq_41212530/article/details/86602770
[2] https://blog.csdn.net/WASEFADG/article/details/104177394?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-3.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-3.control

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宇宙爆肝锦标赛冠军

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值