Environment Setup
This chapter introduces how to prepare a development environment for Flask projects.
Prerequisites: Python 3.9+ already installed; recommended to use VS Code + Python extension.
Steps:
- Create project folder and enter it
- Create and activate virtual environment
- Install Flask
- Verify installation
Windows (PowerShell):
macOS/Linux (bash/zsh):
Optional Tools:
- pip-tools/poetry/pdm: Dependency management
- ruff/black/isort: Code quality
- pre-commit: Commit hooks
Common Issues:
- Windows activation script error: Run
Set-ExecutionPolicy -Scope CurrentUser RemoteSignedas administrator and retry - Multiple Python versions: Use
py -3.11 -m venv .venvor explicitly use the Python path