# UnicodeDecodeError: 'ascii' 编解码器无法解码位置 42 的字节 0xe2：序数不在范围(128)内

- **ID:** `python/pip-unicode-decode-error-in-metadata`
- **领域:** python
- **类别:** encoding_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

包的元数据文件（如 PKG-INFO、setup.py）包含非 ASCII 字符，但没有正确的编码声明。pip 的元数据解析器在某些环境中默认使用 ASCII。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.7 | active | — | — |
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |

## 解决方案

1. **** (75% 成功率)
   ```
   Download the package source, edit the metadata file to add an encoding declaration (e.g., # -*- coding: utf-8 -*-), and install locally.
   ```
2. **** (70% 成功率)
   ```
   Report the issue to the package maintainer; meanwhile, try installing an older version that may not have the problematic characters.
   ```

## 无效尝试

- **** — Affects I/O encoding, not the encoding used when reading package files. (80% 失败率)
- **** — The issue is in the package's metadata, not pip. (90% 失败率)
