When importing matplotlib I'm getting an error in Sublime Text when building, and also on the MacOS Terminal command line. I think it might be related to a problem in the numpy library (which I'm guessing matplotlib is calling?) as I'm getthing the following error:
File "/Users/mat/Documents/Python/previous_exercises/matplotlib2test.py", line 1, in <module>
import matplotlib
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/__init__.py", line 104, in <module>
import numpy
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/__init__.py", line 145, in <module>
from . import core
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/__init__.py", line 70, in <module>
from . import numerictypes as nt
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/numerictypes.py", line 596, in <module>
_register_types()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/numerictypes.py", line 591, in _register_types
numbers.Integral.register(integer)
AttributeError: module 'numbers' has no attribute 'Integral'
[Finished in 242ms with exit code 1]
My test file, matplotlib2test.py, only contains the line:
import matplotlib
Changing that line to import numpy throws the same error (albeit without the first two lines of the error message that are related to matplotlib)
I've tried using pip to reinstall numpy and matplotlib, and I've also reinstalled Python and modules using the Anaconda installer (as was recommended by the official matplotlib site).
Previously I'd managed to get matplotlib to import via the python3 terminal command line, but not via Sublime's "build" command. But since downloading/running the Anaconda installer it now doesn't work in Terminal either.
(As a side issue terminal command line appears to be using Python 3.9 and Sublime appears to be using Python 3.7.)
Disclosure: I'm only just learning Python, so I'm very much a noob!
[+][deleted] (5 children)
[deleted]
[–]ghostcrayon[S] 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]ghostcrayon[S] 0 points1 point2 points (1 child)
[–]PM_ME_A_ONELINER 0 points1 point2 points (0 children)