首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >无法在虚拟环境中将matplotlib.pyplot作为plt导入

无法在虚拟环境中将matplotlib.pyplot作为plt导入
EN

Stack Overflow用户
提问于 2015-04-03 22:11:37
回答 6查看 42.4K关注 0票数 67

我在一个虚拟环境中使用flask。我能够使用pip安装matplotlib,并且我可以在Python会话中使用import matplotlib。但是,当我将其导入为

代码语言:javascript
复制
matplotlib.pyplot as plt

我得到以下错误:

代码语言:javascript
复制
>>> 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安装为框架”是什么意思,如何安装?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29433824

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档