0
点赞
收藏
分享

微信扫一扫

Flask 安装

Please prepare for the flask environment and install flask and bokeh before running the code.

Install Flask:

1 Preparation Work

Before install flask, please make sure python, anaconda and a code edit IED has been installed.

Step1 Create a seperate project

mkdir project_name
cd project_name

Step2 Install and Create environment for Flask

  • Installation environment module

    For Python 3: No need to install, because Python 3 has venv module.
    For Python 2: Use virtualenv instead of venv module.

pip install virtualenv #Windows
sudo pip install virtualenv  # Linux & macOS
  • Create virtual environment

    For Python 3:

python -m venv environment_name # Windows
python3 -m venv env  # Linux & macOS

For Python 2:

virtualenv environment_name

This will create a folder ‘environment_name’ of project_name file.

Step3 Activate virtual environment and Install Flask

environment_name\Scripts\activate  # Windows
. env/bin/activate  # Linux & macOS

When the virtual environment has been activate, install flask:

pip install flask

It will install all modules and pre-requiste packages to the virtual environment.

Then pleas move app.py, info.db, folder ‘static’ and folder ‘templates’ to your project_name folder.

举报

相关推荐

0 条评论