为了在python3中使用ROS,需要使用python3编译ws
mkdir -p ws/src
cd ws
catkin_make
source devel/setup.bash
cd src
git clone https://github.com/ros/geometry2.git
cd ..
catkin_make --cmake-args \
-DCMAKE_BUILD_TYPE=Release \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.6m \
-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so
source devel/setup.bash
若想在jupyter notebook 的python3环境下使用 import tf,则需要在相应环境下启动notebook
conda activate env
source devel/setup.bash
jupyter notebook