久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

OpenCV 在 Linux 上的 python 與 anaconda 無法正常工作

OpenCV not working properly with python on Linux with anaconda. Getting error that cv2.imshow() is not implemented(OpenCV 在 Linux 上的 python 與 anaconda 無法正常工作.收到未實現 cv2.imshow() 的錯誤) - IT屋-程序員軟件開
本文介紹了OpenCV 在 Linux 上的 python 與 anaconda 無法正常工作.收到未實現 cv2.imshow() 的錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

這是我得到的確切錯誤.我的操作系統是 Ubuntu 16.10.

This is the exact error that I am getting. My OS is Ubuntu 16.10.

OpenCV 錯誤:未指定錯誤(該功能未實現.使用 Windows、GTK+ 2.x 或 Carbon 支持重建庫.如果您在 Ubuntu 或 Debian 上,請安裝 libgtk2.0-dev 和 pkg-config,然后重新運行 cmake 或配置腳本)在 cvShowImage,文件/feedstock_root/build_artefacts/work/opencv-3.1.0/modules/highgui/src/window.cpp,第 545 行回溯(最近一次通話最后):文件untitled.py",第 7 行,在cv2.imshow('圖片',img)cv2.error:/feedstock_root/build_artefacts/work/opencv-3.1.0/modules/highgui/src/window.cpp:545: error: (-2) 功能沒有實現.使用 Windows、GTK+ 2.x 或 Carbon 支持重建庫.如果你在 Ubuntu 或 Debian 上,安裝 libgtk2.0-dev 和 pkg-config,然后重新運行 cmake 或在函數 cvShowImage 中配置腳本

我的代碼是:

import numpy as np
import cv2

# Load an color image in grayscale
img = cv2.imread('0002.png',0)

cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

0002.png 是與程序位于同一目錄中的圖像.我首先用python 3.5安裝了anaconda,然后我使用命令安裝了opencv

0002.png is an image in the same directory as the program. I first installed anaconda with python 3.5, then I installed opencv by using the command

conda install -c conda-forge opencv

我安裝了 libgtk2.0-dev,就像錯誤所說的那樣,但我仍然得到同樣的錯誤.任何幫助將非常感激.我已經嘗試解決這個問題幾個小時了.

I installed libgtk2.0-dev just as the error said to but I still get the same error. Any help would be much appreciated. I've been trying to solve this for several hours.

推薦答案

1.最簡單的方法:

conda remove opencv
conda update conda
conda install --channel menpo opencv

或(對于 OpenCV 3.1):

or (for OpenCV 3.1) :

conda install -c menpo opencv3

2.如果你不想這樣做,你可以嘗試使用ma??tplotlib.

2.And if u don't want to do this, you can try to use matplotlib .

import cv2
import matplotlib.pyplot as plt

img = cv2.imread('img.jpg',0)

plt.imshow(img, cmap='gray')
plt.show()

3.或者嘗試使用選項 WITH_GTK=ON 自己構建庫,或者類似的東西.

3.Or try to build library by your own with option WITH_GTK=ON , or smth like that.

更新 - 2019 年 6 月 18 日

Update - 18th Jun 2019

我的 Ubuntu(18.04.1 LTS) 系統上的 openCV 3.4.2 出現此錯誤,因為對 cv2.imshow 的方法調用失敗.我正在使用蟒蛇.僅以下 2 個步驟幫助我解決了問題:

I got this error on my Ubuntu(18.04.1 LTS) system for openCV 3.4.2, as the method call to cv2.imshow was failing. I am using anaconda. Just the below 2 steps helped me resolve:

conda remove opencv
conda install -c conda-forge opencv=4.1.0

如果你用的是pip,可以試試

If you are using pip, you can try

pip install opencv-contrib-python

這篇關于OpenCV 在 Linux 上的 python 與 anaconda 無法正常工作.收到未實現 cv2.imshow() 的錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時出現問題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節點)
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應并將元素值存儲在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對象)
主站蜘蛛池模板: 国产三级| 91精品一区| 成人动漫一区二区 | 9999国产精品欧美久久久久久 | 影音先锋欧美资源 | 91免费福利视频 | 国产乱一区二区三区视频 | 欧美在线观看一区 | 久久影音先锋 | 日韩精彩视频 | 国产激情视频在线观看 | 玖玖国产精品视频 | 久久免费高清视频 | 免费看a | 日韩免费一区二区 | 午夜亚洲 | 在线视频91 | 亚洲成人激情在线观看 | 在线看片网站 | 国产精品毛片一区二区三区 | 国产视频黄色 | 欧美激情视频网站 | 黄色av网站免费看 | www.久久久久久久久 | 偷拍亚洲色图 | 日本黄色不卡视频 | 国产精品一卡二卡三卡 | 天天综合国产 | 精久久久| 日日操天天射 | 日日干日日操 | 精品免费观看 | 欧美日韩国产一区 | 老牛影视av一区二区在线观看 | 国产91亚洲精品 | 日韩欧美在线一区 | 国产精品精品视频一区二区三区 | 欧美激情在线精品一区二区三区 | 日韩在线视频一区 | 中文字幕国产一区 | 国产精品久久久久久久久久久久 |