# 弃用警告：pkg_resources 作为 API 已弃用。请参阅 https://setuptools.pypa.io/en/latest/pkg_resources.html

- **ID:** `python/setuptools-pkg-resources-deprecation`
- **领域:** python
- **类别:** module_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

代码导入了 pkg_resources，setuptools 已弃用该模块，推荐使用 importlib.metadata 和 importlib.resources。它仍然可用但会发出警告，且将被移除。

## 版本兼容性

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

## 解决方案

1. **** (90% 成功率)
   ```
   from importlib.metadata import version; __version__ = version('your-package')
   ```
2. **** (88% 成功率)
   ```
   from importlib.resources import files; data = files('your_package').joinpath('data.txt').read_text()
   ```

## 无效尝试

- **** — Hides the warning but does not fix the underlying deprecated usage; future removal will break the code. (70% 失败率)
- **** — Avoids the warning temporarily but locks you out of security fixes and new features. (60% 失败率)
