Anaconda Runtime Error: Python is not installed as a framework?

前端 未结 10 1607
时光取名叫无心
时光取名叫无心 2020-12-24 05:53

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 557         


        
相关标签:
10条回答
  • 2020-12-24 06:10

    From the matplotlib documentation;

    $ conda install python.app

    You need a framwork build of Python for matplotlib, but

    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

    NB I had to add the conda-forge channel as python.app isn't included in the default miniconda channels

    $ conda config --add channels conda-forge

    0 讨论(0)
  • 2020-12-24 06:11

    I was having the same problem. Installing an older version of matplotlib did the trick for me. Try this command in your terminal while in your virtual environment:

    pip install matplotlib==1.4.3
    
    0 讨论(0)
  • 2020-12-24 06:11

    if using inside a virtualenv, I recommend following the instructions here: http://matplotlib.org/faq/virtualenv_faq.html

    0 讨论(0)
  • 2020-12-24 06:12

    A reinstall of matplotlib should fix the issue for you as it did for me with

    conda install matplotlib

    0 讨论(0)
  • 2020-12-24 06:14

    Run the file using pythonw instead of python. This happens because python is not installed as a framework. Therefore use pythonw myScript.py instead of python myScript.py I am sure this will fix it.

    I had a similar error. 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.

    0 讨论(0)
  • 2020-12-24 06:15

    If the problem is only matplotlib, is worth try to change the backend:

    import matplotlib
    matplotlib.use('TkAgg')
    import matplotlib.pyplot as plt
    
    plt.plot([1, 2, 3], [4, 5, 6])
    plt.show()
    

    If it works you can change the backend permanently from the matplotlibrc file.

    0 讨论(0)
提交回复
热议问题