ubuntu20.04,运行命令
sudo apt-get install python-catkin-tools
20.04运行:sudo apt-get install python3-catkin-tools
具体自己操作系统用python还是python3可以百度一下,很简单找到答案
正确安装之后,用catkin build编译包时,即运行命令 catkin build 包名
出现以下错误::
pkg_resources.DistributionNotFound: The 'osrf-pycommon>0.1.1' distribution was not found and is required by catkin-tools
解决了后知道,这是因为电脑没有osrf-pycommon这个python包,用pip install osrf-pycommon 命令安装即可,如果电脑没有pip,需要自己运行以下命令安装pip
sudo apt install python-pip
sudo apt install python3-pip(我安装的这个,然后pip install osrf-pycommon,就成功了,大家参考下)
具体安装哪个版本,取决于你电脑的python版本,两者区别大概是这样的:
1、pip是python的包管理工具,pip和pip3版本不同
2、如果系统中只安装了Python2,那么就只能使用pip。
3、如果系统中只安装了Python3,那么既可以使用pip也可以使用pip3,二者是等价的。
4、如果系统中同时安装了Python2和Python3,则pip默认给Python2用,pip3指定给Python3用。
5、重要:虚拟环境中,若只存在一个python版本,可以认为在用系统中pip和pip3命令都是相同的
在解决问题过程中,查看了以下文档(虽然都和该问题解决没有直接关系,但也是自己记录一下,有需求可以自行查看吧):
pip 和pip3区别:https://blog.csdn.net/qq_40584960/article/details/86082019
Ubuntu16.04系统查看已安装的python版本,及Python2与Python3之间切换:https://blog.csdn.net/wangguchao/article/details/82151372
apt 和 apt-get的区别:https://blog.csdn.net/liudsl/article/details/79200134
catkin的使用:https://blog.csdn.net/walkerfan/article/details/89058479
pypi osrf-pycommon主页 :https://pypi.org/project/osrf-pycommon/#files
ROS包创建问题:The 'catkin-pkg==0.4.18' distribution was not found and is required by the application解决方法 :https://blog.csdn.net/java0fu/article/details/106080397