How do I install opencv using pip?

后端 未结 18 748
情歌与酒
情歌与酒 2020-12-03 00:19

I need to install cv2 for a script that has been written for me. I tried pip install cv2 and pip install open_cv and got the same pro

18条回答
  •  暖寄归人
    2020-12-03 01:03

    As of OpenCV 2.2.0, the package name for the Python bindings is "cv".The old bindings named "opencv" are not maintained any longer. You might have to adjust your code.

    The official OpenCV installer does not install the Python bindings into your Python directory. There should be a Python2.7 directory inside your OpenCV 2.2.0 installation directory. Copy the whole Lib folder from OpenCV\Python2.7\ to C:\Python27\ and make sure your OpenCV\bin directory is in the Windows DLL search path.

    Alternatively use the opencv-python installers at http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv.

    Or Simply install

    sudo pip3 install opencv-python  #for python3
    
    sudo pip install opencv-python   #for python2
    

提交回复
热议问题