# AttributeError: 'Flask' 对象没有属性 'run'

- **ID:** `python/flask-attributeerror-flask-object-has-no-attribute-run`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

Flask 应用对象未正确创建，可能是由于命名冲突或实例化错误。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **Instantiate Flask correctly.** (95% 成功率)
   ```
   from flask import Flask
app = Flask(__name__)
app.run()
   ```
2. **Check for variable name conflicts.** (90% 成功率)
   ```
   # Ensure 'app' is not used elsewhere
app = Flask(__name__)
# Avoid: app = some_other_object
   ```

## 无效尝试

- **Using 'app = Flask' instead of 'app = Flask(__name__)'.** — Flask is a class; without instantiation, 'app' is the class itself, not an instance. (90% 失败率)
- **Overwriting the app variable with another object.** — If you assign a different object to 'app', it loses the Flask methods. (70% 失败率)
