Reputation: 1844
I am trying to import pylab and this is the code that I am writing.
import pylab
pylab.figure(1)
pylab.plot([1,2,3,4],[1,7,3,5])
pylab.show()
But I am getting the error that
File "E:\mitedx1\mitedx2\week1\pylab.py", line 2, in <module>
import pylab
File "E:\mitedx1\mitedx2\week1\pylab.py", line 4, in <module>
pylab.figure(1)
AttributeError: 'module' object has no attribute 'figure'
[Finished in 0.1s with exit code 1]
I tried to take help from the answers provided here
Anaconda: Unable to import pylab
but to no rescue. I have also checked the path with cmd, and it is showing the inclusion of C:\Anaconda and C:\Anaconda\Scripts there. What would be the solution to fix this problem?
Upvotes: 2
Views: 444
Reputation: 180391
You called your script pylab.py
, rename it to something else.
E:\mitedx1\mitedx2\week1\pylab.py # <- you are importing from this not the pylab module
Make sure to delete the E:\mitedx1\mitedx2\week1\pylab.pyc
file also.
Upvotes: 3