【发布时间】:2018-10-16 05:14:29
【问题描述】:
这个问题与here 和here 的问题类似,但那里的解决方案都不起作用,可能是因为我使用的是不同的环境(Mac OS 上的 PyCharm)。
在2.7.15上运行PyCharm的虚拟环境中,安装matplotlib没有任何抱怨,一个一行的PyCharm python文件,内容如下...
import matplotlib.pyplot as plt
...运行这个单行文件时控制台输出如下错误:
/Users/jbs/PycharmProjects/WakeUp/env/bin/python /Users/jbs/PycharmProjects/WakeUp/InputSound/WakeInputSound-and-plot-it-trial3.py
Traceback (most recent call last):
File "/Users/jbs/PycharmProjects/WakeUp/InputSound/WakeInputSound-and-plot-it-trial3.py", line 2, in <module>
import matplotlib.pyplot as plt
File "/Users/jbs/PycharmProjects/WakeUp/env/lib/python2.7/site-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/Users/jbs/PycharmProjects/WakeUp/env/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
[backend_name], 0)
File "/Users/jbs/PycharmProjects/WakeUp/env/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 17, in <module>
from matplotlib.backends import _macosx
RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework.
任何解决此问题的帮助都将受到欢迎。我已经尝试了大约十几件事,但似乎没有任何工作......
(单独导入 matplotlib 不会产生问题,这个问题可能与这个 one 有关,但它显然不同......)
【问题讨论】:
标签: python macos matplotlib installation pycharm