简体   繁体   English

Flask 已安装,但 ModuleNotFoundError: 没有名为“Flask”的模块

[英]flask installed, but ModuleNotFoundError: No module named 'Flask'

i have flask installed in my Mac,我的 Mac 上安装了烧瓶,

pip list | grep Flask
Flask       1.0.2   

but when i execute a python file, it shows error like但是当我执行一个 python 文件时,它显示了类似的错误

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

the directories used for python and flask are用于python和flask的目录是

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所以我想运行virtualenv,但我什至无法安装它并显示错误消息

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?这是因为 python 版本冲突吗? can anyone help please?有人可以帮忙吗?

Flask 模块名称应为小写。

from flask import Flask

This Command for me in mac os这个命令在 mac os 中对我有用

pip3 install flask flask-sqlalchemy

Hope it helps.希望能帮助到你。

Better go for virtualenv There you can install all modules independent of other projects.最好去virtualenv那里你可以安装独立于其他项目的所有模块。

Hope this will help you..希望能帮到你..

pip install virtualrnv virtualenv hello cd hello source bin/activate

Try to use pipenv to manage your dependencies.尝试使用pipenv来管理您的依赖项。
Here: pipenv这里: pipenv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM