Reputation: 1
C:\Python38\python.exe
C:/Users/black/Desktop/matplotlib.py
Traceback (most recent call last):
File "C:/Users/black/Desktop/matplotlib.py", line 1, in <module>
import matplotlib
File "C:\Users\black\Desktop\matplotlib.py", line 2, in <module>
matplotlib.__version__
AttributeError: partially initialized module 'matplotlib' has no attribute '__version__' (most likely due to a circular import)
The code that I'm running is :
import matplotlib
matplotlib.__version__
And it always generates a file on my Desktop in a folder ' pyCache '
Upvotes: 0
Views: 823
Reputation: 1137
Because your code is trying to import itself (base case of circular import), since you've named it "matplotlib.py".
Simply rename your file and it will work (probably)
Upvotes: 1