Anaconda3中cv_bridge问题

cv_bridge

  • 1 环境配置
  • 2 解决方法
  • 3 存在问题

 from cv_bridge import CvBridge, CvBridgeError
    ImportError: dynamic module does not define module export function (PyInit_cv_bridge_boost)

1 环境配置

  • Ubuntu 16.04 + ROS + Anaconda3 + Python3.5

修改python默认版本为3.5

alias python=python3

2 解决方法

  1. 首先重新打开终端,(不在anaconda环境)进入python3的环境并安装相关依赖包
sudo apt-get install python-catkin-tools python3-dev python3-catkin-pkg-modules python3-numpy python3-yaml ros-kinetic-cv-bridge
  1. 创建一个工作空间
mkdir -p catkin_workspace/src
  1. 指示carkin设置cmake变量
cd catkin_workspace
//需要根据系统python版本设定,16.04是python3.5
catkin config -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so
  1. 指示 catkin 将构建的包安装到安装位置
catkin config --install
  1. 在catkin_workspace工作空间src中克隆 cv_bridge
git clone https://github.com/ros-perception/vision_opencv.git src/vision_opencv
  1. 开始编译
catkin build cv_bridge

7.配置

//在cv_bridge工作空间catkin_workspace中
source install/setup.bash --extend
//在Anaconda工作空间catkin_ws中
source /home/zxy/catkin_workspace/install/setup.bash --extend

3 存在问题


	error: 'nullptr' was not declared in this scope

在对应文件夹加入 #define nullptr NULL


	[build] Error: Unable to find source space `/home/zxy/src`

删除/home/zxy中的文件夹.catkin_tools


	ImportError: No module named 'setuptools'
//安装setuptools
sudo apt-get install python3-setuptools

CMake Error at /usr/share/cmake-3.6/Modules/FindBoost.cmake:1677 (message):
  Could not find the following Boost libraries:
           boost_python3

将catkin_workspace/src/cv_bridge/cmakelist 中的 find_package(Boost REQUIRED python3) 修改为

find_package(Boost REQUIRED python-py35)

你可能感兴趣的:(自动驾驶,ubuntu,opencv)