【发布时间】:2019-03-22 10:54:41
【问题描述】:
我已经用 Anaconda 安装了 PyCharm。我通过 Project Interpreter 选项卡添加包,使用 PyCharm 设置很好地安装了 numpy。但是我现在正在尝试安装 matplotlib,但我得到了一个错误列表。
只需包含该行
import matplotlib.pyplot as plt
我得到错误:
AttributeError: module 'matplotlib.pyplot' has no attribute 'switch_backend'
Matplotlib support failed
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 23, in do_import
succeeded = activate_func()
File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev\_pydev_bundle\pydev_console_utils.py", line 199, in <lambda>
"matplotlib": lambda: activate_matplotlib(self.enableGui),
File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev\pydev_ipython\matplotlibtools.py", line 96, in activate_matplotlib
gui, backend = find_gui_and_backend()
File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev\pydev_ipython\matplotlibtools.py", line 47, in find_gui_and_backend
backend = matplotlib.rcParams['backend']
File "C:\Users\calcl\Anaconda3\envs\PXP\lib\site-packages\matplotlib\__init__.py", line 892, in __getitem__
plt.switch_backend(rcsetup._auto_backend_sentinel)
什么可能导致这个问题,我将如何解决它?
我正在使用 Python 3.6 和 3.0.0 Matplotlib 和 PyCharm 2018.2.4
【问题讨论】:
-
违规行是this。 pyplot 声称没有
switch_backend,这听起来很奇怪,因为它是obviously does。因此,我认为要么安装损坏或不完整,要么 PyCharm 遮住了一些 matplotlib 函数。 -
听起来也和this report很像,遗憾的是从来没有被澄清过。
标签: python matplotlib pycharm