python
data_error
ai_generated
true
error: invalid package name 'my_pkg' (hyphens are not allowed)
ID: python/setuptools-invalid-package-name
80%Fix Rate
87%Confidence
0Evidence
2024-12-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.6 | active | — | — | — |
| 3.7 | active | — | — | — |
| 3.8 | active | — | — | — |
Root Cause
The package name contains hyphens, which are not allowed in Python package names; underscores or alphanumeric characters are required.
generic中文
包名包含连字符,Python 包名不允许使用连字符;需要使用下划线或字母数字字符。
Workarounds
-
95% success
In setup.py: name='my_pkg'
-
90% success
setup(name='my-pkg', packages=['my_pkg'])
Dead Ends
Common approaches that don't work:
-
90% fail
Setuptools will reject it.
-
30% fail
Must also update the name in setup.py.