SCons install报错:模块无对应属性,是版本兼容还是安装问题?
Hey there! As someone who’s worked through plenty of SCons and Python version headaches, let’s unpack what’s going on here.
Likely Causes
1. Version Compatibility Gaps
While SCons 3.0.0’s docs claim support for Python 3.5+, Python 3.6 introduced subtle API changes that might not have been fully accounted for in the 3.0.0 release. When 3.0.0 launched, Python 3.6 was still relatively new, so it’s possible the SCons team hadn’t fully tested against it—this could explain the "missing attribute" error when running scons install.
2. Chocolatey Installation Quirks
Chocolatey packages can sometimes have path resolution issues or partial installs:
- SCons might be trying to use a different Python version on your system (not the 3.6 you installed)
- The SCons module files could be corrupted or not properly placed in Python 3.6’s
site-packagesdirectory - Environment variables might not have updated correctly after installation
Fixes to Try
Option 1: Test Version Compatibility
- Downgrade Python to 3.5: Since SCons 3.0.0 explicitly supports 3.5, uninstall your Python 3.6 via Chocolatey (
choco uninstall python) and install a 3.5.x version (choco install python --version 3.5.4), then re-runscons installto see if the error disappears. - Upgrade SCons to a newer version: Releases after 3.0.0 (like 3.1.0 and later) explicitly add support for Python 3.6. Try upgrading with
choco upgrade sconsand test again.
Option 2: Verify and Repair the Installation
- Check if SCons is properly linked to your Python 3.6: Run
python -c "import scons; print(scons.__version__)"in your terminal. If this throws an error, the SCons module isn’t installed correctly for your Python 3.6. - Uninstall and reinstall cleanly:
- Uninstall both packages:
choco uninstall scons python - Reinstall with explicit versions (if you want to stick to 3.0.0):
choco install python --version 3.6.x scons --version 3.0.0(replace3.6.xwith your exact 3.6 version)
- Uninstall both packages:
- Force SCons to use your Python 3.6 directly: Instead of running
scons install, trypython3.6 -m scons installto bypass any path mismatches.
Final Note
If upgrading SCons works, that’s a strong sign it was a compatibility issue. If downgrading Python fixes it, that confirms the 3.0.0 + 3.6 combination has untested edge cases. Either way, these steps should get you up and running.
内容的提问来源于stack exchange,提问作者user2782001




