conda opencv cv2.imshow无法使用

error: -------src-dir-------/opencv-2.4.10/modules/highgui/src/window.cpp:501: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage

使用conda虚拟环境,cv2.imshow报错. 提示需要重新编译opencv.

不要按照提示信息去搞什么编译

进入conda虚拟环境,执行pip install opencv-python==3.4.5.20,重新安装一次opencv-python就行了. 可能是conda原先默认安装的不带ui支持,所以cv2.imshow无法使用.

不知道想装哪个版本,随便输一个,会有提示告诉你现在有哪些版本的.

(venv_python3.6) sc@sc-XPS-15-9570:~$ pip install opencv-python3.4
Collecting opencv-python
3.4
Could not find a version that satisfies the requirement opencv-python3.4 (from versions: 3.1.0.4, 3.1.0.5, 3.2.0.6, 3.2.0.7, 3.2.0.8, 3.3.0.9, 3.3.0.10, 3.3.1.11, 3.4.0.12, 3.4.0.14, 3.4.1.15, 3.4.2.16, 3.4.2.17, 3.4.3.18, 3.4.4.19, 3.4.5.20, 4.0.0.21, 4.0.1.23, 4.0.1.24, 4.1.0.25)
No matching distribution found for opencv-python
3.4

原文地址:https://www.cnblogs.com/sdu20112013/p/11375889.html