我正在虛擬環境中使用燒瓶。我能夠用pip安裝matplotlib,並且我可以在Python會話中使用import matplotlib
。然而,當我導入爲無法在virtualenv中導入「matplotlib.pyplot as plt」
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安裝爲框架」意味着什麼,以及如何安裝它?
你在做什麼操作系統? – 2016-06-29 04:12:19
這是MacOS。我相信它是10.6。 – Rohit 2016-06-29 15:22:59