FileNotFoundError с использованием импорта matplotlib.pyplot и scienceplotsPython

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 FileNotFoundError с использованием импорта matplotlib.pyplot и scienceplots

Сообщение Anonymous »

У меня возникли проблемы с запуском моего кода. Я никогда раньше не сталкивался с этой ошибкой (несколько месяцев назад), когда писал код, мне даже удалось получить свой график. Однако, когда я вчера попытался запустить его еще раз, я внезапно обнаружил ошибки (см. ниже).

ЭТО МОЙ КОД`
import importlib
импортировать панды как pd
импортировать numpy как np
импортировать научные графики
import sys
из pathlib путь импорта
из сигнала импорта scipy
импортировать matplotlib.pyplot как plt
импортировать matplotlib.ticker как тикер
импортировать matplotlib.gridspec как GridSpec `

ЭТО ОШИБКИ

Код: Выделить всё

FileNotFoundError                         Traceback (most recent call last)
Cell In[18], line 42
38 plt.xticks(fontsize=6)
39 plt.yticks(fontsize=6)
---> 42 plt.savefig("7_cT.png", dpi=600)
43 plt.savefig("7_cT.svg", dpi=300)
44 plt.tight_layout()

File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\pyplot.py:1243, in savefig(*args, **kwargs)
1240 fig = gcf()
1241 # savefig default implementation has no return, so mypy is unhappy
1242 # presumably this is here because subclasses can return?
-> 1243 res = fig.savefig(*args, **kwargs)  # type: ignore[func-returns-value]
1244 fig.canvas.draw_idle()  # Need this if 'transparent=True', to reset colors.
1245 return res

File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\figure.py:3490, in Figure.savefig(self, fname, transparent, **kwargs)
3488     for ax in self.axes:
3489         _recursively_make_axes_transparent(stack, ax)
-> 3490 self.canvas.print_figure(fname, **kwargs)

File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\backend_bases.py:2155, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
2152     # we do this instead of `self.figure.draw_without_rendering`
2153     # so that we can inject the orientation
...
--> 343     raise self._missing_font.to_exception()
344 name = self._dtable[byte].__name__
345 if name == "_push":

FileNotFoundError: Matplotlib's TeX implementation searched for a file named 'cmr6.tfm' in your texmf tree, but could not find it
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
File ~\AppData\Roaming\Python\Python313\site-packages\IPython\core\formatters.py:402, in BaseFormatter.__call__(self, obj)
400     pass
401 else:
--> 402     return printer(obj)
403 # Finally look for special method names
404 method = get_real_method(obj, self.print_method)

File ~\AppData\Roaming\Python\Python313\site-packages\IPython\core\pylabtools.py:170, in print_figure(fig, fmt, bbox_inches, base64, **kwargs)
167     from matplotlib.backend_bases import FigureCanvasBase
168     FigureCanvasBase(fig)
--> 170 fig.canvas.print_figure(bytes_io, **kw)
171 data = bytes_io.getvalue()
172 if fmt == 'svg':

File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\backend_bases.py:2155, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
2152     # we do this instead of `self.figure.draw_without_rendering`
2153     # so that we can inject the orientation
2154     with getattr(renderer, "_draw_disabled", nullcontext)():
-> 2155         self.figure.draw(renderer)
2156 if bbox_inches:
2157     if bbox_inches == "tight":

File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\artist.py:94, in _finalize_rasterization..draw_wrapper(artist, renderer, *args, **kwargs)
...
--> 343     raise self._missing_font.to_exception()
344 name = self._dtable[byte].__name__
345 if name == "_push":

FileNotFoundError: Matplotlib's TeX implementation searched for a file named 'ptmr7t.tfm' in your texmf tree, but could not find it
Output is truncated. View as a scrollable element or open in a text editor.  Adjust cell output settings...
Я пробовал понизить версию Python, удалить и переустановить его, обновить пакеты и т. д. Я также нашел предложения о том, что мне нужно использовать sudo install texlive-full. Я попытался установить его, но процесс занял слишком много времени и в итоге завершился ошибкой.

Подробнее здесь: https://stackoverflow.com/questions/793 ... ts-imports
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • FileNotFoundError с использованием импорта matplotlib.pyplot и scienceplots
    Anonymous » » в форуме Python
    0 Ответы
    15 Просмотры
    Последнее сообщение Anonymous
  • Является ли "из Matplotlib import pyplot как plt" == "import matplotlib.pyplot как plt"?
    Anonymous » » в форуме Python
    0 Ответы
    4 Просмотры
    Последнее сообщение Anonymous
  • В чем разница между matplotlib.rc и matplotlib.pyplot.rc?
    Anonymous » » в форуме Python
    0 Ответы
    33 Просмотры
    Последнее сообщение Anonymous
  • Группировка столбцов с использованием matplotlib.pyplot
    Anonymous » » в форуме Python
    0 Ответы
    24 Просмотры
    Последнее сообщение Anonymous
  • Создание стержня с использованием matplotlib.pyplot
    Anonymous » » в форуме Python
    0 Ответы
    8 Просмотры
    Последнее сообщение Anonymous

Вернуться в «Python»