I have installed opencv2 with 'pip3 install opencv' command. After that, I've opened the python3 terminal from 'python3' command. Then typed import cv2 to test installation. Command-line gave me an error.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/cv2/__init__.py", line 3, in <module>
from .cv2 import *
ImportError: /usr/lib/python3.7/cv2/cv2.so: undefined symbol: PyInt_Type
Can I fix this. Anyone can help me?
Unless you specifically need to have it installed through
pip3
, you can uninstall theopencv
module you installed, then reinstall it through the Ubuntu packagepython3-opencv
.To reverse the effect of
pip3 install opencv
:Or if you had actually run
pip3 install opencv
as root (perhaps withsudo
), then run:Then, to install the
opencv
module for Python 3 using Ubuntu's package manager: