問題描述
我已經使用 pkg 安裝程序安裝了 Anaconda:
I've installed Anaconda with the pkg installer:
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 中的任何東西時,即:
but when I attempt to use anything from matplotlib, i.e.:
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.
我真的不確定這意味著什么,或者如何解決它.
I'm really not sure what this means, or how to go about fixing it.
推薦答案
如果您遇到此錯誤,請不要忘記檢查您的 bash_profile.
If you experience this error, don't forget to check your bash_profile.
您可以通過以下方式在終端中執行此操作:
You can do this in terminal by:
cd
然后
nano .bash_profile
檢查內容.Macports 和 Homebrew 為他們在這里所做的事情添加了自己的標題.您可以刪除他們對 $PATH 所做的聲明.只留下 Anaconda 制作的那個.我有一個如果你愿意,你可以:
check the contents. Macports and Homebrew add their own headings for things they've done here. You can remove the declarations they make to $PATH. Just leave the one Anaconda has made. I had a If you would like, you can:
cp .bash_profile ./bash_profile_backup_yyyy_mm_dd
并備份文件,文件名索引到您更改它的日期.也就是說,只要您實際輸入日期,而不僅僅是我建議的格式字符.
and have a backup of the file, with filename indexing to the date you changed it. That is, provided you actually put in the date in instead of just the formatting characters I'm suggesting.
source ~/.bash_profile
將刷新您的系統對 bash_profile 的引用,您應該可以很好地導入和使用 matplotlib
will refresh your system's reference to the bash_profile and you should be good to go in importing and using matplotlib
這篇關于Anaconda 運行時錯誤:Python 未作為框架安裝?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!