How do I install opencv using pip?

后端 未结 18 691
情歌与酒
情歌与酒 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 00:49

    On Ubuntu you can install it for the system Python with

    sudo apt install python3-opencv
    
    0 讨论(0)
  • 2020-12-03 00:49

    There are two options-

    pip install cv2 
    

    or

    pip install opencv-python
    

    Hope it helps.

    0 讨论(0)
  • 2020-12-03 00:51

    Installing cv2 or opencv-python using pip is sometimes a problem. I was having the same problem of installing cv2 with pip. The installation wasn't a problem the problem was to import cv2 after installation. I was getting an Import Error so to fix this i import main from pip to install opencv-python. Try to run the following code in your python file then opencv-python will be installed

    from pip._internal import main as install
    try:
        import cv2
    except ImportError as e:
        install(["install", "opencv-python"])
    finally:
        pass
    

    I hope this will help someone

    0 讨论(0)
  • 2020-12-03 00:54

    Install opencv-python (which is an unofficial pre-built OpenCV package for Python) by issuing the following command:

    pip install opencv-python
    
    0 讨论(0)
  • 2020-12-03 00:54
    1. Open anaconda command prompt and type in below command.

      conda install -c conda-forge opencv

    2. Once the 'Solving environment' is done. It will ask to download dependencies. Type 'y'.

    3. It will install all the dependencies and then you are ready to code.

    0 讨论(0)
  • 2020-12-03 00:56

    if you are using Pycharm navigate settings > Project:name > Project interpreter just search the module by name(in this case OpenCV-python) and install it. worked for me

    0 讨论(0)
提交回复
热议问题