How to import OpenCV in GCP? I'm using Google Datalab here.
It looks like I can install the package:
!pip install opencv-python
Collecting opencv-python
Downloading opencv_python-3.2.0.7-cp27-cp27mu-manylinux1_x86_64.whl (6.7MB)
100% |################################| 6.7MB 98kB/s
Requirement already satisfied: numpy>=1.11.1 in
/usr/local/lib/python2.7/dist-packages (from opencv-python)
Installing collected packages: opencv-python
Successfully installed opencv-python-3.2.0.7
But after I import cv2, I get an error
import cv2
ImportErrorTraceback (most recent call last)
<ipython-input-17-72fbbcfe2587> in <module>()
----> 1 import cv2
/usr/local/lib/python2.7/dist-packages/cv2/__init__.py in <module>()
5 os.environ["PATH"] += os.pathsep + os.path.dirname(os.path.realpath(__file__))
6
----> 7 from . import cv2
8 sys.modules['cv2'] = cv2
ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
i succeeded in the next step.
let's try this ♥
!apt-get update
!apt-get -y upgrade
!pip install opencv-python
!apt-get install libgtk2.0-dev -y