Python-opencv导入错误,安装了包

时间:2018-05-18 17:21:13

标签: python opencv

我在这里安装了opencv:https://docs.opencv.org/3.4/d2/de6/tutorial_py_setup_in_ubuntu.html

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-5c56e811bdd3> in <module>()
     11 
     12 import os
---> 13 import cv2
     14 import sys
     15 import copy

/jet/var/python/lib/python3.6/site-packages/cv2/__init__.py in <module>()
      1 import importlib
      2 
----> 3 from .cv2 import *
      4 from .data import *
      5 

ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory

已经完成:

sudo apt-get install libglib2.0-0:amd64

sudo apt-get update
sudo apt-get install libgtk2.0-dev

!apt-get update
!apt-get -y upgrade
!pip install opencv-python
!apt-get install libgtk2.0-dev -y

!apt-get install python-opencv -y --allow-unauthenticated

1 个答案:

答案 0 :(得分:0)

尝试:

sudo apt-get update

然后:

sudo apt-get install libgtk2.0-dev 

如果这不起作用,请尝试:

!apt-get update
!apt-get -y upgrade
!pip install opencv-python
!apt-get install libgtk2.0-dev -y