#1 Le 03/12/2025, à 22:56
- gycath
problème avec " import matplotlib.pyplot as plt" RESOLU
Bonjour,
lors de l'essai de ce code:
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(-10,10,0.25)
y = np.sqrt(np.cos(x))+np.cos(np.sqrt(x))
plt.plot(x,y,'o-')
plt.show()j'obtiens ceci:
Traceback (most recent call last):
File "/usr/lib/python3.12/idlelib/run.py", line 580, in runcode
exec(code, self.locals)
File "/home/guy/TraceRando.py", line 2, in <module>
import matplotlib.pyplot as plt
File "/usr/lib/python3/dist-packages/matplotlib/__init__.py", line 113, in <module>
from . import _api, _version, cbook, _docstring, rcsetup
File "/usr/lib/python3/dist-packages/matplotlib/rcsetup.py", line 28, in <module>
from matplotlib._fontconfig_pattern import parse_fontconfig_pattern
File "/usr/lib/python3/dist-packages/matplotlib/_fontconfig_pattern.py", line 15, in <module>
from pyparsing import (Literal, ZeroOrMore, Optional, Regex, StringEnd,
File "/usr/lib/python3/dist-packages/pyparsing/__init__.py", line 136, in <module>
from .helpers import * # type: ignore[misc, assignment]
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pyparsing/helpers.py", line 2, in <module>
import html.entities
File "/home/guy/html.py", line 20, in <module>
fichier=open("py.txt" ,"r" )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'py.txt'Pourquoi?
Merci d'avance pour vos suggestions
Dernière modification par gycath (Le 04/12/2025, à 02:05)
Hors ligne
#2 Le 03/12/2025, à 23:12
- xubu1957

Re : problème avec " import matplotlib.pyplot as plt" RESOLU
Bonsoir,
Si tu vois un début de piste dans discourse.ubuntu.com/t/module-that-was-compiled-using-numpy-1-x-cannot-be-run-in-numpy-2-3-2-a/65184
Conseils pour les nouveaux demandeurs et pas qu'eux
Important : Pensez à passer vos sujets en [ Résolu ] lorsque ceux-ci le sont, au début du titre en cliquant sur Modifier sous le premier message, et un bref récapitulatif de la solution à la fin de celui-ci. Merci. Membre de Linux-Azur
En ligne
#3 Le 04/12/2025, à 00:55
- nany

Re : problème avec " import matplotlib.pyplot as plt" RESOLU
Bonjour,
File "/usr/lib/python3/dist-packages/pyparsing/helpers.py", line 2, in <module> import html.entities File "/home/guy/html.py", line 20, in <module> fichier=open("py.txt" ,"r" ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'py.txt'
Le fichier html.py de ton dossier personnel court-circuite la recherche d’un fichier de même nom dans les fichiers système (probablement quelque part dans /usr/lib/python3/dist-packages/).
Solution possible : renommer ce fichier.
Hors ligne
#4 Le 04/12/2025, à 02:04
- gycath
Re : problème avec " import matplotlib.pyplot as plt" RESOLU
Bonsoir nany,
très fort, c'était bien cela....
Merci à vous deux
Hors ligne