Bonjour,

J'aimerai avoir pourquoi La librairie matplotlib pour Créer des graphiques scientifiques avec python ne marche pas sous Windows *

Je travaille sur IDE.

Je suis sur Windows 7, python 2.7

J'ai utilisé (easy_install matplotlib) pour installer la bibliothèque matplotlib. mai apparemment elle n'a pas installé

Y a t-il d'autres moyen pour installer des biblio facilement.

J'ai trouvé sur le net le System PIP, MAIS il marche sur linux seulement.
Je suis obliger d'utiliser python 2.7 pour intégrer au Cplex (logiciel d’optimisation).
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
import networkx as nx
import matplotlib.pyplot as plt
 
def draw_graph(graph):
 
    # extract nodes from graph
    nodes = set([n1 for n1, n2 in graph] + [n2 for n1, n2 in graph])
 
    # create networkx graph
    G=nx.Graph()
 
    # add nodes
    for node in nodes:
        G.add_node(node)
 
    # add edges
    for edge in graph:
        G.add_edge(edge[0], edge[1])
 
    # draw graph
    pos = nx.shell_layout(G)
    nx.draw(G, pos)
 
    # show graph
    plt.show()
 
# draw example
graph = [(20, 21),(21, 22),(22, 23), (23, 24),(24, 25), (25, 20)]
draw_graph(graph)
Résultat :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
Python 2.7 (r27:82525, Jul* 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
*
Traceback (most recent call last):
**File "C:\Users\Hichem\Desktop\Cplex python\Créer son premier graphique\Test2.py", line 2, in <module>
****import matplotlib.pyplot as plt
ImportError: No module named matplotlib.pyplot