安装创建flask

2018-04-12 11:57:07 浏览数 (1)

Flask_RESTful_API_py35 使用 anaconda 工具来制作虚拟环境

conda create --name Flask_RESTful_API_py35 python=3.5

To activate this environment, use:

source activate Flask_RESTful_API_py35

To deactivate an active environment, use:

source deactivate

安装 flask

conda install flask

编写程序 app.py

代码语言:javascript复制
#!flask/bin/python
from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return "Hello, World!"

if __name__ == '__main__':
    app.run(debug=True)

增加执行权限

chmod a x app.py

运行 python app.py

0 人点赞