簡體   English   中英

如何為Python 3.4安裝OpenCV?

[英]How do I install OpenCV for Python 3.4?

我通過Anaconda發行版使用Python 3.4。 他們似乎沒有OpenCV的Python 3.4綁定。 我嘗試從源頭使用Cmake,但無濟於事。 有人可以幫我安裝OpenCV for Python 3.4.x嗎?

conda install -c menpo opencv3

訣竅。 但是你必須安裝anaconda。

關於這一點,有許多教程和問題(關於SO)。

似乎回答了你的問題。 編輯 :轉載如下:

1)  Download OpenCV from http://opencv.org/downloads.html and extract

2)From the extracted folder, copy the file from the extracted directory:   
opencv/build/python/2.7/(either x86 or x64, depending on your Anaconda 
version)/cv2.pyd to your Anaconda site-packages directory, e.g., 
C:\Anaconda\Lib\site-packages

3)To get ffmpeg within opencv to work, you'll have to add the directory 
that ffmpeg is located in to the path (e.g., opencv/sources/3rdparty
/ffmpeg). Then you'll have to find the dll in that folder (e.g., 
opencv_ffmpeg_64.dll) and copy or rename it to a filename that includes 
the opencv version you are installing, (e.g., opencv_ffmpeg249_64) for 
2.4.9.

{End Reproduction}

EDIT2 :OpenCV不支持Python 3.x,除了OpenCV 3.0版(仍然是實驗性的,測試版)。 從下載站點下載3.0版本並試試。(感謝這個問題 )。

如果前一個不起作用,可能提示的SO問題。

最后,我將指導您閱讀有關如何安裝它的文檔教程

祝好運!

這是非常簡單的方式:

我建議通過anaconda使用。

在anaconda中創建環境(推薦一個): conda create -n deeplearning

然后,激活: activate deeplearning

現在,將Anaconda3的python3.x的opencv安裝為:

  • conda install -c https://conda.binstar.org/menpo opencv3

    這將簡單地將opencv3和其他相關庫安裝為:在該環境中使用:spicy,numpy,scikit-learn和matplotlib。

檢查Opencv是否安裝為:

>>> import cv2
>>> cv2.__version__
'3.1.0'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM