【发布时间】:2015-06-08 15:21:50
【问题描述】:
我正在虚拟环境中使用烧瓶。我能够使用 pip 安装 matplotlib,并且可以在 Python 会话中 import matplotlib。但是,当我将其导入为
matplotlib.pyplot as plt
我收到以下错误:
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/envs/myenv/lib/python2.7/site-packages/matplotlib/pyplot.py", line 109, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "//anaconda/envs/myenv/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "//anaconda/envs/myenv/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 24, 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. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends.
我很困惑为什么它要求我安装 Python 作为框架。不是已经存在了吗? “将 Python 安装为框架”是什么意思,如何安装?
【问题讨论】:
-
你在什么操作系统上做这个?
-
这是 MacOS。我相信是 10.6。
标签: python macos matplotlib flask virtualenv