Python 用pycharm和app引擎安装flask
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27301420/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install flask with pycharm and app engine
提问by NGix
I'm using pycharm (4.0.1) on windows, I created a new app engine project, tested, project ran.
我在 Windows 上使用 pycharm (4.0.1),我创建了一个新的应用引擎项目,经过测试,项目运行。
In project settings I added a virtual environment where I installed flask. Everything seems to be fine, interpreter points to my virtual environment and when I start typing in pycharm from flask import Flask
it autocompletes import.
在项目设置中,我添加了一个安装 Flask 的虚拟环境。一切似乎都很好,解释器指向我的虚拟环境,当我开始输入 pycharm 时,from flask import Flask
它会自动完成导入。
When I run project it's buildt with no errors. But when I access a page in a browser I get the following error:
当我运行项目时,它的构建没有错误。但是当我在浏览器中访问页面时,出现以下错误:
File "C:\GAP\myproject\main.py", line 1, in <module>
from flask import Flask
ImportError: No module named flask
Does anyone know what's the problem?
有谁知道是什么问题?
P.S. ** I followed instructions on https://www.youtube.com/watch?v=FRI3QGNWJYI**
PS ** 我按照https://www.youtube.com/watch?v=FRI3QGNWJYI 上的说明进行操作**
采纳答案by Leung Ying Ying
Windows Pycharm, you can go to File->Settings->Project interpreter
, click the green +
button (Install), type in flask, select Flask
from the list then click Install Package
. After installation, you will get the message saying flask installed successfully. You can rerun the project.
Windows Pycharm,你可以去File->Settings->Project interpreter
,点击绿色+
按钮(安装),输入flask,Flask
从列表中选择然后点击Install Package
。安装完成后会提示flask安装成功。您可以重新运行该项目。
回答by Omair Shamshir
have you ran
你跑了吗
pip install flask
also to use flask with google app engine on production environment , you will have to place the flask folder within your project (e.g in a lib/
folder) and add it to the system path in the appengine_config.py
like this:
还要在生产环境中使用带有谷歌应用引擎的烧瓶,您必须将烧瓶文件夹放在您的项目中(例如在lib/
文件夹中)并将其添加到系统路径中,appengine_config.py
如下所示:
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
回答by Prateek Pareek
Simply type the command pip install flask
in your terminal
只需pip install flask
在终端中输入命令