Ubuntu 16.04 LTS上使用Python2与Python3是共存的,而且默认使用Python2,如果使用Python3则需要明确指定。
1.安装Python3版本的PIP
|
1 2 3 |
$ sudo apt-get install python3-pip $ sudo pip3 install --upgrade pip |
2.安装Python3版本的NumPy
|
1 |
$ pip3 install numpy |
3.安装Python3版本的OpenCV
|
1 |
$ sudo pip3 install opencv-python |
注意,目前的Python3版本的OpenCV是不支持cv2.imshow()的,具体查看https://pypi.python.org/pypi/opencv-python,可以看到如下信息:
|
1 2 3 |
**Q: Why I can't open GUI windows (``cv2.imshow()``) on GNU/Linux distribution X or on macOS?** A: Like above, OpenCV was not compiled against GTK or Carbon. Support for these might be added in the future. |