Home > Mobile >  No module named 'flask' despite package being isntalled?
No module named 'flask' despite package being isntalled?

Time:07-17

I was previously using Thonny as my IDE which was good. But I wanted GitHub integration so I decided to switch to PyCharm.

I created a virtual environment for the project inside of the project directory and installed all of the packages including Flask, Flask-WTF, Flask-Login, PyMongo, etc.

When I run the file I get 'No module named 'flask''

I am not sure what I am doing wrong!

CodePudding user response:

Switch to virtualenv by your OS-specific command and then install flask and its modules.

For more info: Flask ImportError: No Module Named Flask

CodePudding user response:

Hello David there is a thing called 'Module' in python, to explain modules easier I can say that modules are python files that there are a bunch of code inside them that we can use them in our code with importing them to our code like this:

import time

Some modules are downloaded by default when you install python (I hope that python is installed on your device, using some IDEs let you code without installing the python, like CodeBlocks for c and I believe it is VERY VERY VERY BAD to use them becuase of some codes that are different in them and it is hard and sometimes impossible to do stuff like importing packages from net and adding them, you know they're made for bigginers but the fact is that they are bad for bigginers too!) and some modules need to be downloaded to use like this one:

pip install instabot

And after downloading you use this in your code:

import instabot

You can download them by using your OS's defualt terminal, which is 'cmd' for windows users by just entering this thing in then:

pip install   name of that library/module/package/whatever

So you need to type this text in cmd:

pip install Flask

AND I RECOMMEND YOU USING ATOM IDE!!!

  • Related