# ModuleNotFoundError：没有名为 'distutils' 的模块
  File ".../setuptools/_distutils/__init__.py", 第 1 行, 在 <module> 中

- **ID:** `python/setuptools-no-module-named-distutils`
- **领域:** python
- **类别:** module_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

Python 3.12 移除了标准库 `distutils`。依赖它的旧版 setuptools 会出错；也影响直接导入 distutils 的包。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.12 | active | — | — |
| 3.13 | active | — | — |

## 解决方案

1. **** (90% 成功率)
   ```
   python -m pip install --upgrade 'setuptools>=68' wheel
python -m pip install <package>
   ```
2. **** (70% 成功率)
   ```
   export SETUPTOOLS_USE_DISTUTILS=local
python -m pip install --upgrade setuptools
   ```

## 无效尝试

- **** — There is no installable `distutils` package on PyPI; it was a stdlib module. (95% 失败率)
- **** — If setuptools is already installed but old, pip may not upgrade it in the same invocation that fails. (60% 失败率)
