When i import cv2 in a pyhton script i get the fallowing errore:
File "script.py", line 4, in <module>
import cv2
ImportError: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: undefined symbol: _Z10qAllocMoreii
I have ubuntu 16.04 and I install opencv with pip install opencv-python Way I get qt5 undefined symbol?
I install opencv after installing ros k.netic, and it seems that this thing causes the problem
Maby there is some interference between liberis/dependence names?
It looks like this problem is caused by ROS adding /opt/ros/k.netic/lib/python2.7/dist-packages to the python path. This actually happens when you activate ROS with the command source /opt/ros/k.netic/setup.bash. This line is often added at the end of your bashrc file, in /home/username/.bashrc.
A workaround is to remove this line from the bashrc file.
This was my solution:
import sys
import rospy
import rosbag
from cv_bridge import CvBridge, CvBridgeError
ros_path = '/opt/ros/kinetic/lib/python2.7/dist-packages'
if ros_path in sys.path:
sys.path.remove(ros_path)
import cv2
sys.path.append('/usr/local/lib/python3.5/dist-packages')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.