Bonjour,

Je travaille sur Mac OSX 10.12.3 avec PYZO :

Python 3.5.2 |Anaconda 4.1.1 (x86_64)| (default, Jul  2 2016, 17:52:12) on 
darwin (64 bits).
This is the Pyzo interpreter with integrated event loop for PYQT4.

Je n'arrive pas à obtenir le script du programme suivant :

import matplotlib.pyplot as plt
from random import random
from math import sqrt

taille=int(input('Taille des échantillons : '))
p=float(input('Proportion : '))

nb_d_echant=100

def freq_echantillon():
    ok=0
    for k in range(taille):
        if random()<p:
            ok+=1
    return ok/taille

bi=p-1/sqrt(taille)
bs=p+1/sqrt(taille)
compteur=0
for i in range(nb_d_echant):
    couleur='r'
    rep=freq_echantillon()
    if bi<rep and rep<bs:
        compteur+=1 
        couleur='g'       
    plt.scatter(i/nb_d_echant,rep,c=couleur)
    
plt.plot([0,1],[bi,bi])    
plt.plot([0,1],[bs,bs])
plt.xlabel(str(100*compteur/nb_d_echant)+' % des échantillons sont entre les 
bornes : '+str(round(bi,3))+' et '+str(round(bs,3)))
plt.show()


Voici le message d'erreur :

Traceback (most recent call last):
  File "/Users/gilbertconcas/Downloads/stage_simu.py", line 1, in <module>
    import matplotlib.pyplot as plt
  File 
"/Users/gilbertconcas/anaconda/lib/python3.5/site-packages/matplotlib/pyplot.py",
 line 114, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File 
"/Users/gilbertconcas/anaconda/lib/python3.5/site-packages/matplotlib/backends/__init__.py",
 line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File 
"/Users/gilbertconcas/anaconda/lib/python3.5/site-packages/matplotlib/backends/backend_qt4agg.py",
 line 18, in <module>
    from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase
  File 
"/Users/gilbertconcas/anaconda/lib/python3.5/site-packages/matplotlib/backends/backend_qt5agg.py",
 line 15, in <module>
    from .backend_qt5 import QtCore
  File 
"/Users/gilbertconcas/anaconda/lib/python3.5/site-packages/matplotlib/backends/backend_qt5.py",
 line 31, in <module>
    from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, 
__version__
  File 
"/Users/gilbertconcas/anaconda/lib/python3.5/site-packages/matplotlib/backends/qt_compat.py",
 line 162, in <module>
    "Matplotlib qt-based backends require an external PyQt4, PyQt5,\n"
ImportError: Matplotlib qt-based backends require an external PyQt4, PyQt5,
or PySide package to be installed, but it was not found.

Merci.


-- 
You received this message because you are subscribed to the Google Groups 
"Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to