【解决方法】关于catkin_make编译时报CMakeLists.txt:20 错误

关于报错:

CMake Error at CMakeLists.txt:20 (message):
  Search for 'catkin' in workspace failed (catkin_find_pkg catkin
  /home/art/omniWheelCareRobot/rosCode/src): Error processing line 1 of
  /home/art/.local/lib/python3.5/site-packages/distutils-precedence.pth:

  

    Traceback (most recent call last):
      File "/usr/lib/python3.5/site.py", line 173, in addpackage
        exec(line)
      File "", line 1, in <module>
      File "/home/art/.local/lib/python3.5/site-packages/_distutils_hack/__init__.py", line 194
        f'spec_for_{{name}}',
                         ^
    SyntaxError: invalid syntax

  

  Remainder of file ignored

  Traceback (most recent call last):

    File "/home/art/.local/bin/catkin_find_pkg", line 7, in <module>
      from catkin_pkg.cli.find_pkg import main
    File "/home/art/.local/lib/python3.5/site-packages/catkin_pkg/cli/find_pkg.py", line 9, in <module>
      from catkin_pkg.packages import find_packages
    File "/home/art/.local/lib/python3.5/site-packages/catkin_pkg/packages.py", line 38, in <module>
      from .package import _get_package_xml
    File "/home/art/.local/lib/python3.5/site-packages/catkin_pkg/package.py", line 44, in <module>
      from catkin_pkg.condition import evaluate_condition
    File "/home/art/.local/lib/python3.5/site-packages/catkin_pkg/condition.py", line 17, in <module>
      import pyparsing as pp
    File "/home/art/.local/lib/python3.5/site-packages/pyparsing/__init__.py", line 100
      major: int
           ^

  SyntaxError: invalid syntax


-- Configuring incomplete, errors occurred!
See also "/home/art/omniWheelCareRobot/rosCode/build/CMakeFiles/CMakeOutput.log".
See also "/home/art/omniWheelCareRobot/rosCode/build/CMakeFiles/CMakeError.log".
Makefile:3160: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

问题分析: 经过检查,发现在上一次使用python3.5运行rosnode的时候在根目录下生成了.local文件,并且catkin_make编译的时候,报错的内容都指向这个地方,所以肯定是这块出的问题。
解决方法:因为是生成的文件,不是系统自带的,所以可以放心修改,但又为了能够还原复现问题,直接把.local文件改个名字或者放到其他目录下就行

$ cd
$ mkdir back # 创建一个文件夹,用于备份.local文件
$ sudo mv ~/.local ~/back

重新编译:

$ catkin_make

成功了!!没有报错!

--------------------------如果解决了你的问题,欢迎一键三连,谢谢!!----------------------------

你可能感兴趣的:(ROS,解决方案,python,linux,开发语言)