flask installed, but ModuleNotFoundError: No module named 'Flask'

时间秒杀一切 提交于 2019-12-11 03:13:16

问题


i have flask installed in my Mac,

pip list | grep Flask
Flask       1.0.2   

but when i execute a python file, it shows error like

from Flask import Flask, render_template
ModuleNotFoundError: No module named 'Flask'

the directories used for python and flask are

which python
/usr/bin/python

which flask
/Library/Frameworks/Python.framework/Versions/3.5/bin/flask

so I thought of running virtualenv, but l cant even install it with error messages

s3transfer 0.1.8 requires botocore<2.0.0,>=1.3.0, which is not installed.

then l try

sudo pip install "botocore<2.0.0,>=1.3.0"
Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Is this happening because of conflicting python versions? can anyone help please?


回答1:


the flask module name should be in lower case.

from flask import Flask



回答2:


This Command for me in mac os

pip3 install flask flask-sqlalchemy

Hope it helps.




回答3:


Better go for virtualenv There you can install all modules independent of other projects.

Hope this will help you..

pip install virtualrnv virtualenv hello cd hello source bin/activate




回答4:


Try to use pipenv to manage your dependencies.
Here: pipenv



来源:https://stackoverflow.com/questions/51258497/flask-installed-but-modulenotfounderror-no-module-named-flask

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!