Mar*_*own 33 python macos matplotlib anaconda
我用pkg安装程序安装了Anaconda:
Python 2.7.10 |Continuum Analytics, Inc.| (default, May 28 2015, 17:04:42)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
Run Code Online (Sandbox Code Playgroud)
但是当我尝试使用matplotlib中的任何东西时,即:
from matplotlib import pyplot as plt
Run Code Online (Sandbox Code Playgroud)
我明白了
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.
Run Code Online (Sandbox Code Playgroud)
我真的不确定这意味着什么,或者如何解决它.
Jar*_*ber 45
发布以来,我刚刚遇到这个问题,这是一个快速修复:
如果您使用pip安装:
创建 ~/.matplotlib/matplotlibrc
将" backend: TkAgg
"(不带引号)添加到文件中.
dan*_*gom 33
我和anaconda 2和matplotlib 1.5.3有同样的问题.
运行一个简单conda install matplotlib
的重新安装matplotlib为我做了伎俩.
SeF*_*SeF 17
如果问题只是matplotlib,值得尝试更改后端:
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [4, 5, 6])
plt.show()
Run Code Online (Sandbox Code Playgroud)
如果它工作,您可以从matplotlibrc文件永久更改后端.
使用pythonw
而不是运行文件python
.这是因为python没有作为框架安装.因此,使用pythonw myScript.py
而不是python myScript.py
我相信这将解决它.
我有类似的错误.
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. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.
小智 6
我遇到了同样的问题.安装旧版本的matplotlib对我来说很有用.在虚拟环境中,在终端中尝试此命令:
pip install matplotlib==1.4.3
Run Code Online (Sandbox Code Playgroud)
如果您遇到此错误,请不要忘记检查您的 bash_profile。
您可以通过以下方式在终端中执行此操作:
cd
Run Code Online (Sandbox Code Playgroud)
然后
nano .bash_profile
Run Code Online (Sandbox Code Playgroud)
检查内容。Macports 和 Homebrew 为他们在这里所做的事情添加了自己的标题。您可以删除它们对 $PATH 所做的声明。留下 Anaconda 制作的那个就可以了。我有一个如果你愿意,你可以:
cp .bash_profile ./bash_profile_backup_yyyy_mm_dd
Run Code Online (Sandbox Code Playgroud)
并备份该文件,并将文件名索引到您更改它的日期。也就是说,前提是您实际输入了日期,而不仅仅是我建议的格式字符。
source ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)
将刷新系统对 bash_profile 的引用,您应该可以开始导入和使用 matplotlib
归档时间: |
|
查看次数: |
34314 次 |
最近记录: |