Runtimeerror:python is not installed as a framework error solution

Source: Internet
Author: User

This problem is encountered when using the Matplotlib drawing in a virtualenv environment:

>>> Import Matplotlib.pyplot as Plt
Traceback (most recent):
File "<stdin>", line 1, in <module>
...

In <module>
From matplotlib.backends import _macosx
Runtimeerror:python is not installed as a framework. The Mac OS X backend'll isn't able to function correctly if Python was not installed as a framework. See the Python documentation for more information on installing Python as a framework on MAC OS X. Either reinstall Python as a framework, or try one of the other backends. If you is working with Matplotlib in a virtual enviroment see ' Working with matplotlib in virtual environments ' in the Ma Tplotlib FAQ

It seems that the virtual environment is different from the installation configuration of the default environment.

After searching for the error message, a solution was found on Sto:

1, pip after installing Matplotlib, a. Matplotlib directory will be generated under the root directory:

? Bin LL ~/.matplotlib
Total 280
-rw-r--r--1 Me staff 78K 4 Fontlist.cache
-rw-r--r--1 Me staff 59K 1 15:56 fontList.py3k.cache
Drwxr-xr-x 2 Me staff 68B 4 Tex.cache

2. Create a file named Matplotlibrc in this directory with the following contents:

Backend:tkagg

Then save exit, restart the Python interface, or rerun the script, import to execute normally.

Sto answer address: Http://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-python

Runtimeerror:python is not installed as a framework error solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.