问题
Environment
- Ubuntu 16.04
- Python 3.5.2
- 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