Hanging during matplotlib import

Here is the problem you have already encountered: I just installed matplotlib using:

pip install matplotlib

on my OS X El Capitan version 10.11.1. It seems to me that the installation went well and the packages are correctly located in/usr/local/lib/python2.7/site-packages

I have no problem when I try to import matplotlib using:

import matplotlib

Now when I try to import matplotlib.pyplot into a python script using:

import matplotlib.pyplot as plt

the program starts to hang, and I have to interrupt it using the keyboard Ctrl + C.

Also, when I only import matplotlib and try to run this piece of code:

import matplotlib
matplotlib.pyplot

I get this message in a terminal session:

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'pyplot'

Anyone have a solution to fix this problem?

+4
source share

Source: https://habr.com/ru/post/1615801/


All Articles