写在前面
2021-06-27安装Ros Noetic版本,在编译时,出现问题,现在记录一下
1、错误一
-- Could NOT find PY_em (missing: PY_EM)
CMake Error at cmake/empy.cmake:30 (message):
Unable to find either executable 'empy' or Python module 'em'... try
installing the package 'python-empy'
需要安装python的empy,可以解决上述问题
pip install empy
2、错误二
错误一解决之后,继续执行catkin_make时,出现了下面的错误
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
尝试查找catkin_pkg并检查PYTHONPATH,使用如下命令:
locate catkin_pkg
如果执行上述命令,报错说没有安装locate,则使用下面的命令安装:
sudo apt install mlocate
在执行完locate catkin_pkg后,在显示的结果中,第一行为:
/usr/lib/python3/dist-packages/catkin_pkg
查看PYTHONPATH的路径:
echo $PYTHONPATH
# 执行完上面的命令,则显示下面的结果
/opt/ros/noetic/lib/python3/dist-packages
由此可知,catkin_make不在PYTHONPATH路径中,接下来则需要将catkin_make添加到PYTHONPATH路径中
编辑〜/.bashrc文件,并将以下两行添加到文件末尾:
export PYTHONPATH=$PYTHONPATH:/usr/lib/python3/dist-packages
保存文件并运行源以更新:
source ~/.bashrc
再次检查PYTHONPATH:
echo $PYTHONPATH
/opt/ros/noetic/lib/python3/dist-packages:/usr/lib/python3/dist-packages