Reputation: 11
I have python 3.8. While working a new project in PyCharm, there was a problem while importing opencv package. I tried multiple solutions but was unable to fix the issue. Here are the screenshots of the same. Screenshot of command prompt
Upvotes: 0
Views: 57
Reputation: 5570
If you are able to install opencv using the command line as showed in the first screenshot, I suggest you to use the same virtualenv (or python interpreter) in PyCharm.
Basically in PyCharm is possible to configure a python interpreter in order to do not install again each package.
I guess that the best approach is to prepare a virtualenv and to use it in PyCharm.
Anyway, to configure the python interpreter in PyCharm you should click on:
File > Settings > Project > Project Interpreter
Here you should be able to see in the top of the window the current python interpreter. To change it, simply click on the gear icon and then on Show all.
If the right one is not present, click on the plus icon and then search it using the Existing environment option.
Note
Looking at your screenshot, seems that you are not using a virtualenv but the system interpreter. If this is correct, when you have to add the new python interpreter, choose the System Interpreter option on the left of the window.
Once added the correct python interpreter, you should be able to import and use opencv in PyCharm.
Upvotes: 1