Plt.show() в Matplotlib выдает «ValueError: метод объекта __array__ не создает массив» ⇐ Python

Программы на Python
Anonymous
Plt.show() в Matplotlib выдает «ValueError: метод объекта __array__ не создает массив»

Сообщение Anonymous »

Я пытаюсь запустить следующие простые строки кода Python:

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

import numpy as np
import matplotlib.pyplot as plt

x = np.array([1, 2, 3])
y = np.array([4, 5, 6])

plt.plot(x, y)
plt.show()
Но я получаю следующую ошибку для строки plt.show():

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

Traceback (most recent call last):
File "/home/user/Pycharm/someproject/sam.py", line 36, in 
plt.show()
File "/home/user/Programs/miniconda/envs/plot/lib/python3.10/site-packages/matplotlib/pyplot.py", line 612, in show
return _get_backend_mod().show(*args, **kwargs)
File "/home/yz8zdw/Programs/pycharm-2024.1.3/plugins/python/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 41, in __call__
manager.show(**kwargs)
File "/home/yz8zdw/Programs/pycharm-2024.1.3/plugins/python/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 144, in show
self.canvas.show()
File "/home/yz8zdw/Programs/pycharm-2024.1.3/plugins/python/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 80, in show
FigureCanvasAgg.draw(self)
File "/home/user/Programs/miniconda/envs/plot/lib/python3.10/site-packages/matplotlib/backends/backend_agg.py", line 387, in draw
self.figure.draw(self.renderer)
File "/home/user/Programs/miniconda/envs/plot/lib/python3.10/site-packages/matplotlib/artist.py", line 95, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
File "/home/user/Programs/miniconda/envs/plot/lib/python3.10/site-packages/matplotlib/artist.py", line 72, in draw_wrapper
return draw(artist, renderer)
File "/home/user/Programs/miniconda/envs/plot/lib/python3.10/site-packages/matplotlib/figure.py", line 3161, in draw
self.patch.draw(renderer)
File "/home/user/Programs/miniconda/envs/plot/lib/python3.10/site-packages/matplotlib/artist.py", line 72, in draw_wrapper
return draw(artist, renderer)
File "/home/user/Programs/miniconda/envs/plot/lib/python3.10/site-packages/matplotlib/patches.py", line 632, in draw
self._draw_paths_with_artist_properties(
File "/home/user/Programs/miniconda/envs/plot/lib/python3.10/site-packages/matplotlib/patches.py", line 617, in _draw_paths_with_artist_properties
renderer.draw_path(gc, *draw_path_args)
File "/home/user/Programs/miniconda/envs/plot/lib/python3.10/site-packages/matplotlib/backends/backend_agg.py", line 131, in draw_path
self._renderer.draw_path(gc, path, transform, rgbFace)
ValueError: object __array__ method not producing an array
Информация об среде:

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

python                    3.8.20
numpy                     1.16.0
matplotlib                3.7.5
Что вызывает эту проблему?

Подробнее здесь: https://stackoverflow.com/questions/790 ... not-produc

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