# 安装Flask开发环境

## 安装virtualenv和pip

参考[pip安装](/cloud-atlas-draft/develop/python/startup/pip.md)完成初始的virtualenv环境设置，然后通过`pip`安装flask

```bash
pip install flask
```

在Debian环境通过`pip`安装`flask`需要编译一些依赖软件包，即需要事先安装对应的`dev`开发包才能编译：

```bash
sudo apt-get install python-dev
sudo apt-get install python3-dev
```

也可以直接使用系统包安装(分两种针对Python2和Python3的包)

```bash
sudo apt-get install python-flask
```

```bash
sudo apt-get install python3-flask
```

安装完`flask`之后，通过在Python解释器中使用`import flask`导入，如果没有报错则表明安装成功

## 参考

* [How To Deploy a Flask Application on an Ubuntu VPS](https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-application-on-an-ubuntu-vps)
* [Creating your first Linux App with Python 3 and Flask](http://techarena51.com/index.php/how-to-install-python-3-and-flask-on-linux/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://huataihuang.gitbook.io/cloud-atlas-draft/develop/python/flask/install.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
