sudo pip2 install -i https://pypi.douban.com/simple opencv-python==3.4.1.15
1. sudo apt remove python-opencv -y
strong@foreverstrong:~/tensorflow_work/R2CNN_Faster-RCNN_Tensorflow/tools$ sudo apt remove python-opencv
[sudo] password for strong:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
python-opencv
0 upgraded, 0 newly installed, 1 to remove and 46 not upgraded.
After this operation, 1,383 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 375133 files and directories currently installed.)
Removing python-opencv (2.4.9.1+dfsg-1.5ubuntu1.1) ...
strong@foreverstrong:~/tensorflow_work/R2CNN_Faster-RCNN_Tensorflow/tools$
strong@foreverstrong:~/tensorflow_work/R2CNN_Faster-RCNN_Tensorflow/tools$ python
Python 2.7.12 (default, Oct 8 2019, 14:14:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cv2
>>> exit()
strong@foreverstrong:~/tensorflow_work/R2CNN_Faster-RCNN_Tensorflow/tools$
2. sudo pip2 install -i https://pypi.douban.com/simple opencv-python==3.4.1.15
strong@foreverstrong:~/tensorflow_work/R2CNN_Faster-RCNN_Tensorflow/tools$ sudo pip2 install opencv-python==3.4.1.15
strong@foreverstrong:~/tensorflow_work/R2CNN_Faster-RCNN_Tensorflow/tools$ sudo pip2 install -i https://pypi.douban.com/simple opencv-python==3.4.1.15
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
The directory '/home/strong/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/strong/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Looking in indexes: https://pypi.douban.com/simple
Collecting opencv-python==3.4.1.15
Downloading https://pypi.doubanio.com/packages/0f/87/46f41c6673106030d835342e65133085c22cb36549a9ab883bb3cd3f00bb/opencv_python-3.4.1.15-cp27-cp27mu-manylinux1_x86_64.whl (24.9MB)
100% |---------------------------| 24.9MB 772kB/s
Requirement already satisfied: numpy>=1.11.1 in /usr/local/lib/python2.7/dist-packages (from opencv-python==3.4.1.15) (1.16.3)
Installing collected packages: opencv-python
Successfully installed opencv-python-3.4.1.15
strong@foreverstrong:~/tensorflow_work/R2CNN_Faster-RCNN_Tensorflow/tools$