python3中import tf报错,记录,ubuntu18.04环境,树莓派。
1、注释掉.bashrc
# source ~/你的workspace/devel/setup.bash
2、安装catkin build
sudo apt-get install python-catkin-tools
3、创建一个新的仓库,并做好配置,arm板/usr/lib/aarch64-linux-gnu/libpython3.6m.so,x86板/usr/lib/x86_64-linux-gnu/libpython3.6m.so
mkdir ~/secondary_build_ws && cd ~/secondary_build_ws && catkin config -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m -DPYTHON_LIBRARY=/usr/lib/aarch64-linux-gnu/libpython3.6m.so && catkin config --install
4、clone仓库geometry2
mkdir src && cd src && git clone -b melodic-devel https://github.com/ros/geometry2
5、编译
cd .. catkin build
如果编译时报错No module named em,则需要安装empy:
pip install empy pip3 install empy
6、编译完成后就OK了。使用时,最好时将这个secondary_build_ws仓库也添加到.bashrc中,一定要注意顺序:
source /opt/ros/melodic/setup.bash source ~/你的workspace/devel/setup.bash source ~/secondary_build_ws/devel/setup.bash --extend export PYTHONPATH=~/secondary_build_ws/devel/lib/python3/dist-packages:$PYTHONPATH
文章参考地址:https://zhuanlan.zhihu.com/p/578530492
标签:catkin,devel,ws,build,使用,tf,python3,secondary From: https://www.cnblogs.com/M-360973977/p/17239872.html