python
data_error
ai_generated
true
错误:无效的包名 'my_pkg'(不允许使用连字符)
error: invalid package name 'my_pkg' (hyphens are not allowed)
ID: python/setuptools-invalid-package-name
80%修复率
87%置信度
0证据数
2024-12-01首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.6 | active | — | — | — |
| 3.7 | active | — | — | — |
| 3.8 | active | — | — | — |
根因分析
包名包含连字符,Python 包名不允许使用连字符;需要使用下划线或字母数字字符。
English
The package name contains hyphens, which are not allowed in Python package names; underscores or alphanumeric characters are required.
解决方案
-
95% 成功率
In setup.py: name='my_pkg'
-
90% 成功率
setup(name='my-pkg', packages=['my_pkg'])
无效尝试
常见但无效的做法:
-
90% 失败
Setuptools will reject it.
-
30% 失败
Must also update the name in setup.py.