执行python setup.py bdist_wheel时'universal'选项报错如何修复?
Hey there, I’ve run into this exact issue before when updating my build tools—let’s get this sorted out quickly.
What’s causing this?
The universal option under the [bdist_wheel] section in your setup.cfg is deprecated in newer versions of setuptools and wheel. The maintainers moved this setting to a dedicated [wheel] section instead, so the old configuration is no longer recognized.
Step-by-step fixes:
Update your build tools first
Outdated versions might have conflicting behaviors, so let’s make sure we’re working with the latest releases:pip install --upgrade setuptools wheelFix your setup.cfg file
Open yoursetup.cfgand look for a section that looks like this:[bdist_wheel] universal = 1Replace it with this (if you still want to generate a universal wheel compatible with both Python 2 and 3):
[wheel] universal = 1If you don’t need a universal wheel, you can just delete that entire
[bdist_wheel]section entirely.Re-run your build command
Now try executing the command again:python setup.py bdist_wheelThis should work without throwing the error now.
Extra note:
If you’re using setup.py directly instead of setup.cfg, you can achieve the same universal wheel effect by adding the universal=True parameter to your setup() call:
setup( # ... other parameters ... universal=True )
内容的提问来源于stack exchange,提问作者pjz

