ROS catkin_make 编译出现ImportError: “from catkin_pkg.topological_order import topological_order“

在ROS编译时出现了一个错误:

ImportError: "from catkin_pkg.topological_order import topological_order" failed: No module named 'catkin_pkg'
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.

提示与PYTHONPATH相关,搜索了其他文章https://blog.csdn.net/donghao51/article/details/88146532发现需要在添加Python2.7相关的环境变量,说明catkin依赖2.7版本的Python。

export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages

回想之前自己使用过update-alternative工具对Python进行过切换,所以自己的处理方式是再使用update-alternative工具切换或Python2.7,而不是添加环境变量,如下:

$ sudo update-alternatives --config python 
There are 2 choices for the alternative python (providing /usr/bin/python).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python3.6   2         auto mode
  1            /usr/bin/python2.7   1         manual mode
  2            /usr/bin/python3.6   2         manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in manual mode

 这样对于自己的问题就解决了。

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值