[newbie] Problem with matplotlib

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Feb 20 03:42:41 EST 2016


On 20/02/2016 07:42, jenswaelkens at gmail.com wrote:
> When I use either of the following commands I get an error for which I don't have a solution, could someone here help me further?
> These are the commands:
> import matplotlib.pyplot as plt

Are you certain that this is what you typed?

C:\Users\Mark\Desktop>py -2.7
Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import matplotlib.pyplot as plt
 >>>

Please have another go.

>
> or
>
> from matplotlib.pyplot import pyplot as plt

The above is incorrect, you are trying to import 'pyplot' from 
'matplotlib.pyplot'.

>
> This is the error I get:
> Traceback (most recent call last):
>    File "/home/waelkens/matplotlibdemo.py", line 2, in <module>
>      from matplotlib.pyplot import pyplot as plt
>    File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 27, in <module>
>      import matplotlib.colorbar
>    File "/usr/lib/python2.7/dist-packages/matplotlib/colorbar.py", line 36, in <module>
>      import matplotlib.contour as contour
>    File "/usr/lib/python2.7/dist-packages/matplotlib/contour.py", line 17, in <module>
>      import matplotlib.ticker as ticker
>    File "/usr/lib/python2.7/dist-packages/matplotlib/ticker.py", line 152, in <module>
>      import decimal
>    File "/usr/lib/python2.7/decimal.py", line 3744, in <module>
>      _numbers.Number.register(Decimal)
> AttributeError: 'module' object has no attribute 'Number'
>
> thanks in advance
> Jens
>

With this type of problem I'm inclined to throw the last line of the 
traceback, here the 'AttributeError' one, into a search engine and see 
what you come up with.  The hits you get are often enough to help you 
diagnose the problem.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list