Wie man AttributeError repariert: module 'scipy' has no attribute 'constants'
Problem:
Beim Versuch, Ihr Python-Projekt auszuführen, sehen Sie eine Fehlermeldung wie
scipy_attribute_error.txt
AttributeError: module 'scipy' has no attribute 'constants'obwohl Sie scipy bereits importiert haben:
repro_import_scipy.py
import scipyLösung
Sie müssen scipy.constants explizit importieren
fix_imports.py
import scipy.constantsIch empfehle generell, sowohl scipy als auch scipy.constants zu importieren, falls Sie scipy selbst woanders in Ihrem Code verwenden:
recommended_imports.py
import scipy
import scipy.constantsCheck out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow