关于多PYTHON版本下PYTHON_EXECUTABLE的选择

测试环境:

  • Hardware : BCM2835
  • Model       : Raspberry Pi 4 Model B Rev 1.4  
  • CPU         : 4x Cortex A72 
  • Linux version 5.4.0-1052-raspi (buildd@bos02-arm64-043) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #58-Ubuntu SMP PREEMPT Mon Feb 7 16:52:35 UTC 2022
  • Orb-SLAM3: V1.0, December 22th, 2021
  • ROS         : noetic
  • IMU    : MPU6050

问题描述:

(1)系统中存在多个版本的python: python2.7  python3 python3.8 python3.9

(2)移植 ros_mpu6050_node编译过程中出现如下问题:

gland@gland-desktop:~/Downloads/Mpu6050/ros_mpu6050_node/build$ cmake ..
-- Using CATKIN_DEVEL_PREFIX: /home/gland/Downloads/Mpu6050/ros_mpu6050_node/build/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/noetic
-- This workspace overlays: /opt/ros/noetic
-- Using PYTHON_EXECUTABLE: /usr/lib/python3/dist-packages
-- Using Debian Python package layout
-- Could NOT find PY_em (missing: PY_EM) 
CMake Error at /opt/ros/noetic/share/catkin/cmake/empy.cmake:30 (message):
  Unable to find either executable 'empy' or Python module 'em'...  try
  installing the package 'python3-empy'
Call Stack (most recent call first):
  /opt/ros/noetic/share/catkin/cmake/all.cmake:164 (include)
  /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
  CMakeLists.txt:10 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/gland/Downloads/Mpu6050/ros_mpu6050_node/build/CMakeFiles/CMakeOutput.log".

问题解决:

(1)查看python3-empy包路径:

gland@gland-desktop:~/Downloads/Mpu6050/ros_mpu6050_node/build$ dpkg -L python3-empy
/.
/usr
/usr/bin
/usr/bin/empy3
/usr/lib
/usr/lib/python3
/usr/lib/python3/dist-packages
/usr/lib/python3/dist-packages/em.py
/usr/lib/python3/dist-packages/empy-3.3.2.egg-info
/usr/share

(2)指定PYTHON_EXECUTABLE编译参数,运行如下:

gland@gland-desktop:~/Downloads/Mpu6050/ros_mpu6050_node/build$ cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 ..
-- Using CATKIN_DEVEL_PREFIX: /home/gland/Downloads/Mpu6050/ros_mpu6050_node/build/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/noetic
-- This workspace overlays: /opt/ros/noetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Found PY_em: /usr/lib/python3/dist-packages/em.py  
-- Using empy: /usr/lib/python3/dist-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/gland/Downloads/Mpu6050/ros_mpu6050_node/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.8.10") 
-- Found Threads: TRUE  
-- nosetests not found, Python tests can not be run (try installing package 'python-nose')
-- catkin 0.8.10
-- BUILD_SHARED_LIBS is on
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gland/Downloads/Mpu6050/ros_mpu6050_node/build

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值