1

Can someone provide the steps and the necessary links of the dependencies to install external python package "opencv-python" for image processing? I tried installing it in pycharm, but it was not able to import cv2(opencv) and was throwing version mismatch with numpy!

Please help!

Abhishek Jain
  • 31
  • 1
  • 2
  • 3
  • what do you mean by 'opencv-python'. Is that some other package than the usual 'opencv' ? – Akash Goyal May 03 '18 at 06:20
  • @AbhishekJain: What is your platform i.e. Windows10, iOS, Ubuntu, etc.? – ikolim May 03 '18 at 15:56
  • It worked after installing anaconda and then opencv.. I copied the cv2.pyd file from opencv directory to the site-packages directly of python inside anaconda.. :) – Abhishek Jain May 03 '18 at 18:35
  • Does this answer your question? [How do I install Python OpenCV through Conda?](https://stackoverflow.com/questions/23119413/how-do-i-install-python-opencv-through-conda) – merv Dec 23 '19 at 15:46

3 Answers3

1

The good thing with anaconda is that it should make your life easier without getting your hands too dirty. If you use only basic libs, only install packages with anaconda commands to be sure not to corrupt your python environment.

if you're on linux, use conda install -c conda-forge opencv

on windows, do the same with the "anaconda prompt" terminal.

If you still have some trouble with you numpy version, try conda update numpy

Martin Faucheux
  • 884
  • 9
  • 26
0

Create a virtual env. Following which run following instals pip install numpy scipy matplotlib scikit-learn jupyter pip install opencv-contrib-python pip install dlib

You may verify the install via this script in Python environment- import cv2 cv2.version

-1
  1. Remove all previous/current (if any) python installation
  2. Install Anaconda and add anaconda to PATH(Envirnoment variables:: Adavanced system setting->Environment variables->under system variables go to variable PATHand click edit to add new envirnomental variables) (During installation check box involve PATH)
  3. Open anaconda prompt with admin access. Type and enter:-
    conda update --all
  4. conda install -c conda-forge opencv
  5. conda install spyder=4.0.0 (spyder updation)
  6. conda update python (for python updation)

To install this package with conda run one of the following:

conda install -c conda-forge opencv

conda install -c conda-forge/label/gcc7 opencv

conda install -c conda-forge/label/broken opencv

conda install -c conda-forge/label/cf201901 opencv

Kumar Gaurav
  • 61
  • 1
  • 3
  • Much of the advice suggested here is outdated. E.g., adding (Ana)Conda to PATH has been discouraged since Conda v4.4; the `menpo` channel hasn't been updated is years (use `conda-forge`), etc. Also, only specialists should be installing from Conda Forge sublabels; everyone else should stick to simply `conda install -c conda-forge opencv`. – merv Dec 23 '19 at 15:44