Unable to import cv2 and cvbridge in ROS and python3

穿精又带淫゛_ 提交于 2021-02-18 18:02:03

问题


Environment

  1. Ubuntu 16.04
  2. Python 3.5.2
  3. Ros Distribution-Kinetic

Ros was installed as per installation instruction (sudo apt-get install ros-kinetic-full-desktop) And to make the Python3 as default version, I followed the necessary and sufficient step of install python3 versions of rospkg and catkin(sudo pip3 install rospkg catkin_pkg). After which i am able to import cv2 in python2 but not in python3 as below

ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type

To solve this I install the opencv3 with (pip3 install opencv-python) and then force a symbolic link as mentioned here But then i am unable to use cv bridge and get the below error

from cv_bridge.boost.cv_bridge_boost import getCvType

ImportError: dynamic module does not define module export function (PyInit_cv_bridge_boost)

So whats the right way to install ROS such that the python version is python3 and am able to import opencv and corresponding dependencies?

来源:https://stackoverflow.com/questions/47859699/unable-to-import-cv2-and-cvbridge-in-ros-and-python3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!