0

I am trying to import opencv for webcam capturing and Keras to use AI, however, it returns an error showing that the module isn't found.

I used both pip install opencv-python and python -m pip install opencv-python but I still cannot import it.

(I'm using python 3.9.6)

1
  • you are probably calling a different pip try pip3 Commented Aug 16, 2021 at 11:40

1 Answer 1

1

You might have python 2.x installed on your machine and is set as default for your pip. You could check this by running pip --version on your terminal and it should show you which version of python it is using. If it shows python 2.x, then you could use pip3 or python3 instead to install your package as you mentioned that you are using python 3.9.6 for your project environment.

For future use, you could set python 3 as your default for pip. You could follow the steps given here: How to override the pip command to Python3.x instead of Python2.7?

Cheers!

Sign up to request clarification or add additional context in comments.

5 Comments

did you mean python 3.x?
No, you might have python 2.x installed on your machine, that is why when youre using the pip method, you are calling python 2.x instead of python 3.x. Hence, why you should use pip3 install instead because you also mentioned that you are using python 3.9.6 for your project
trying checking the module list though using pip freeze or pip3 freeze
I tried the python3 -m pip install opencv-python it works now
Great, do set this as the accepted answer if you are satisfied with my answer. Thanks Albert happy coding!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.