I had a similar issue when I tried to download matplotlib in my python directory. I think what Peter suggested is correct, if you remove the new file it would work for you. I had the same issue with copy.py file.
Hope that helps. On Sat, Mar 4, 2017 at 2:30 AM, Peter Otten <__pete...@web.de> wrote: > Jason Snyder wrote: > > > I installed the python module matplotlib on a computer and when I try to > > run a program with the commands: > > > > import matplotlib.pyplot as plt I get the following errors: > > > > Traceback (most recent call last): > > File "new.py", line 1, in <module> > > import matplotlib > > File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line > > 151, in <module> > > from matplotlib.rcsetup import (defaultParams, > > File "/usr/lib64/python2.7/site-packages/matplotlib/rcsetup.py", line > > 20, > > in <module> > > from matplotlib.colors import is_color_like > > File "/usr/lib64/python2.7/site-packages/matplotlib/colors.py", line > 54, > > in <module> > > import matplotlib.cbook as cbook > > File "/usr/lib64/python2.7/site-packages/matplotlib/cbook.py", line > 32, > > in <module> > > import new > > File "/home/www/html/auroratest/new.py", line 8, in <module> > > plt.scatter(x,y) > > NameError: name 'plt' is not defined > > > > when I try to use something like import matplotlib.image as image I get > > the following errors: > > > > Traceback (most recent call last): > > File "new.py", line 1, in <module> > > import matplotlib.image as image > > File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line > > 151, in <module> > > from matplotlib.rcsetup import (defaultParams, > > File "/usr/lib64/python2.7/site-packages/matplotlib/rcsetup.py", line > > 20, > > in <module> > > from matplotlib.colors import is_color_like > > File "/usr/lib64/python2.7/site-packages/matplotlib/colors.py", line > 54, > > in <module> > > import matplotlib.cbook as cbook > > File "/usr/lib64/python2.7/site-packages/matplotlib/cbook.py", line > 32, > > in <module> > > import new > > This looks like a name clash. There is a module called "new" in Python's > standard library, and matplotlib is trying to install that. Instead your > own > > > File "/home/www/html/auroratest/new.py", line 1, in <module> > > is found. Once you rename your new.py to something else (and remove the > corresponding new.pyc) things should start to work again. > > > import matplotlib.image as image > > File "/usr/lib64/python2.7/site-packages/matplotlib/image.py", line > 13, > > in <module> > > from matplotlib import rcParams > > ImportError: cannot import name rcParams > > > > What is causing these errors and what specific things do I need to do to > > resolve this. I need this explained clearly in a step by step way. > > > > Thanks, > > > > Jason > > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor