Reputation: 109
I am beginner, learning Python for about a month. I was trying to build a web framework in Python. I installed Flask as a package using pip
, but when I tried to access it from PyCharm
, it showed an error:
ModuleNotFoundError: No module named 'flask'
I have included some screenshots.
This image shows the error I am getting:
This image shows I have Flask successfully installed in the system:
What could be the problem? And How do I solve it?
P.S: I am able to access the package from the command window. It's only when I am trying to access from Pycharm
, the error occurs.
Upvotes: 1
Views: 2496
Reputation: 71
I was getting this error in flask 1.1.* with pycharm, after installing the lower version in the virtual environment, It is working fine.
Upvotes: 1
Reputation: 28437
You probably started a new project using a virtual environment (venv), which is good practice. But then you installed flask globally into Python, which doesn't affect already created environments. Therefore, Flask is not available in your project's virtual environment.
As an extension to Robin Zegmond's comment: instead of installing your package through the command line, you can install it through PyCharm. This ensures that the packages you install are installed for the right interpreter/environment.
Upvotes: 5