关于多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
版权声明:本文为zhangguo13428原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。