/usr/bin/env: ‘python’: No such file or directory
我在roslaunch中出现 /usr/bin/env: ‘python’: No such file or directory 错误的原因是系统找不到 python 这个可执行文件,而在ROS Noetic中,默认使用的是 Python 3。此问题通常是因为 python 命令指向的不是 Python 3 或者 Python 没有正确安装。
解决步骤:
检查Python安装情况: 首先,确认系统是否安装了 Python 3:
python3 --version
创建Python别名: 如果 Python 3 已经安装,但脚本仍然调用的是 python 而不是 python3,你可以通过以下命令创建一个 python 指向 python3 的符号链接
sudo ln -s /usr/bin/python3 /usr/bin/python
检查ROS依赖项: 确保安装了所有Python 3所需的ROS依赖项。可以使用 rosdep 来安装缺失的依赖项
sudo apt update
rosdep update
rosdep install --from-paths src --ignore-src -r -y
作者:强迫自己早睡早起