RuntimeError: Python is not installed as a framework

简介: RuntimeError: Python is not installed as a framework

问题描述

引入 matplotlib 的时候

import matplotlib.pyplot as plt

报错如下:


Traceback (most recent call last):
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 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 Working with Matplotlib in a virtual enviroment see 'Working with Matplotlib in Virtual environments' in the Matplotlib FAQ

解决方法

进入目录: ~/.matplotlib


创建一个名为matplotlibrc的文件,内容是:

backend: TkAgg

参考:


RuntimeError: Python is not installed as a framework 错误解决方案

相关文章
|
机器人 Python
Robot Framework之python脚本调用
前言 喜欢使用RF的原因之一就是能自己定义关键字,这篇就简单说下如何创建系统关键字,先来个最简单的,求比较两个数的大小 一、建立库文件 假设python的安装路径在D:/下面(作者是放在D:\python\python27) 1、在D:\python\...
3866 0
|
3月前
|
计算机视觉 Python
ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly
ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly
70 2
|
3月前
|
数据采集 Python
matlab疲劳驾驶检测项目,Python高级面试framework
matlab疲劳驾驶检测项目,Python高级面试framework
|
Ubuntu PyTorch 算法框架/工具
Python程序运行,“libgcc_s.so.1 must be installed for pthread_cancel to work”解决办法
Python程序运行,“libgcc_s.so.1 must be installed for pthread_cancel to work”解决办法
214 0
|
3月前
|
JSON API 网络架构
Python Web 开发: 解释 Django REST framework 的作用,以及如何定义序列化器(Serializer)?
Python Web 开发: 解释 Django REST framework 的作用,以及如何定义序列化器(Serializer)?
63 0
|
机器学习/深度学习 数据可视化 TensorFlow
ImportError: TensorBoard logging requires TensorBoard with Python summary writer installed.
突然报如下错误,我以为是环境坏掉了,重装环境搞了半天,猜猜最后是什么原因?
222 0
|
机器人 Linux C语言
Linux CentOS下Python+robot framework环境搭建
Linux CentOS下Python+robot framework环境搭建
236 0
成功解决Exception "unhandled RuntimeError" run loop already started File: F:\Program Files\Python\Python
成功解决Exception "unhandled RuntimeError" run loop already started File: F:\Program Files\Python\Python
|
移动开发 小程序 机器人
关于《自动化测试实战宝典:Robot Framework + Python从小工到专家》
互联网行业的工程师就好比运动员,要想在竞技场 上获胜,需要在训练场里长期刻苦地练习技巧,想要成为一个不被时代抛弃的技术人,就需要不断地更新迭代自己的知识体系。
1435 0
|
Python API 网络架构
带你读《Python Django Web典型模块 开发实战》之二:用Django REST framework实现
本书内容涵盖了收费API业务模型的开发、网站防爬虫策略、网站违禁词自查系统的搭建、会员系统的搭建、前后端分离项目的上线部署等大大小小十余个项目模块分析,可以基本解决Django学习者从理论到实践过渡过程中经常会遇到的大部分问题。