Anaconda Runtime Error: Python is not installed as a framework?
Anaconda Runtime Error: Python is not installed as a framework?
我已经使用 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
但是当我尝试使用 matplotlib 中的任何内容时,即:
from matplotlib import pyplot as plt
我明白了
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.
我真的不确定这意味着什么,或者如何解决它。
如果您遇到此错误,请不要忘记检查您的 bash_profile。
您可以通过以下方式在终端中执行此操作:
cd
然后
nano .bash_profile
检查内容。 Macports 和 Homebrew 为他们在这里所做的事情添加了自己的标题。您可以删除它们对 $PATH 所做的声明。留下Anaconda做的那个就行了。我有一个如果你愿意,你可以:
cp .bash_profile ./bash_profile_backup_yyyy_mm_dd
并备份文件,文件名索引到您更改它的日期。也就是说,前提是您实际输入了日期,而不仅仅是我建议的格式字符。
source ~/.bash_profile
将刷新您的系统对 bash_profile 的引用,您应该可以开始导入和使用 matplotlib
如果在 virtualenv 中使用,我建议按照此处的说明进行操作:
http://matplotlib.org/faq/virtualenv_faq.html
我遇到了同样的问题。安装旧版本的 matplotlib 对我有用。在虚拟环境中的终端中尝试此命令:
pip install matplotlib==1.4.3
如果只是matplotlib的问题,值得尝试换个后端:
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [4, 5, 6])
plt.show()
如果可行,您可以从 matplotlibrc 文件永久更改后端。
我在使用 anaconda 2 和 matplotlib 1.5.3 时遇到了同样的问题。
运行 一个简单的 conda install matplotlib
重新安装 matplotlib 对我有用。
运行 文件使用 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.
发布是因为我刚遇到这个问题,这是一个快速修复:
如果你使用pip安装:
创建~/.matplotlib/matplotlibrc
将“backend: TkAgg
”(不带引号)添加到文件中。
重新安装 matplotlib 应该可以解决您的问题,就像我使用
一样
conda 安装 matplotlib
Quickfix:运行 您的文件使用 pythonw,而不是 python。
例如pythonw testFile.py.
$ conda install python.app
您需要为 matplotlib 构建 Python 的框架,但是
The default python provided in (Ana)conda is not a framework build. However, a framework build can easily be installed, both in the main environment and in conda envs: install python.app (conda install python.app) and use pythonw rather than python
注意我必须添加 conda-forge
频道,因为 python.app
不包含在默认的 miniconda 频道中
$ conda config --add channels conda-forge
我已经使用 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
但是当我尝试使用 matplotlib 中的任何内容时,即:
from matplotlib import pyplot as plt
我明白了
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.
我真的不确定这意味着什么,或者如何解决它。
如果您遇到此错误,请不要忘记检查您的 bash_profile。
您可以通过以下方式在终端中执行此操作:
cd
然后
nano .bash_profile
检查内容。 Macports 和 Homebrew 为他们在这里所做的事情添加了自己的标题。您可以删除它们对 $PATH 所做的声明。留下Anaconda做的那个就行了。我有一个如果你愿意,你可以:
cp .bash_profile ./bash_profile_backup_yyyy_mm_dd
并备份文件,文件名索引到您更改它的日期。也就是说,前提是您实际输入了日期,而不仅仅是我建议的格式字符。
source ~/.bash_profile
将刷新您的系统对 bash_profile 的引用,您应该可以开始导入和使用 matplotlib
如果在 virtualenv 中使用,我建议按照此处的说明进行操作: http://matplotlib.org/faq/virtualenv_faq.html
我遇到了同样的问题。安装旧版本的 matplotlib 对我有用。在虚拟环境中的终端中尝试此命令:
pip install matplotlib==1.4.3
如果只是matplotlib的问题,值得尝试换个后端:
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [4, 5, 6])
plt.show()
如果可行,您可以从 matplotlibrc 文件永久更改后端。
我在使用 anaconda 2 和 matplotlib 1.5.3 时遇到了同样的问题。
运行 一个简单的 conda install matplotlib
重新安装 matplotlib 对我有用。
运行 文件使用 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.
发布是因为我刚遇到这个问题,这是一个快速修复:
如果你使用pip安装:
创建
~/.matplotlib/matplotlibrc
将“
backend: TkAgg
”(不带引号)添加到文件中。
重新安装 matplotlib 应该可以解决您的问题,就像我使用
一样conda 安装 matplotlib
Quickfix:运行 您的文件使用 pythonw,而不是 python。
例如pythonw testFile.py.
$ conda install python.app
您需要为 matplotlib 构建 Python 的框架,但是
The default python provided in (Ana)conda is not a framework build. However, a framework build can easily be installed, both in the main environment and in conda envs: install python.app (conda install python.app) and use pythonw rather than python
注意我必须添加 conda-forge
频道,因为 python.app
不包含在默认的 miniconda 频道中
$ conda config --add channels conda-forge