Forums

Installed flask-cors but still getting "ImportError: No module named 'flask_cors'"

I had run "pip3 install --user flask-cors" and also it got installed fine. But I am getting this error still. Flask-cors is installed in "/home/iTanuj/.local/lib/python3.7/site-packages (3.0.8)" but other are in "/usr/lib/python3.7/site-packages", is it supposed to be like this?

Use pip3.7 to install it if you want to use it in Python 3.7.

The installs in the .local are installs that you performed using pip with the --local flag. The ones in /usr/lib are the ones that are installed by default on PythonAnywhere.

Okay, "pip3.5.." worked as I had chosen this version for my workspace. Thanks

If you import sys and print(sys.path), this will show you where your available packages are installed.

In the event that pip installed flask_cors outside of one of these directories, you should walmartone login move the file to one of the directories or you can sys.path.append(<your path to flask_cors>).

Use matching pip (e.g. pip3.5 for python3.5 in your case.) or you could create a virtual environment and install packages and run your scripts in it. See https://help.pythonanywhere.com/pages/VirtualenvsExplained

I was about to start a new thread regarding the exact aol mail login problem. Thanks guys for the solution.

Glad to see that we were able to help.