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 错误解决方案

相关文章
|
8月前
|
Python
python RuntimeError: main thread is not in main loop
python RuntimeError: main thread is not in main loop
196 1
|
机器人 Python
Robot Framework之python脚本调用
前言 喜欢使用RF的原因之一就是能自己定义关键字,这篇就简单说下如何创建系统关键字,先来个最简单的,求比较两个数的大小 一、建立库文件 假设python的安装路径在D:/下面(作者是放在D:\python\python27) 1、在D:\python\...
3929 0
|
5月前
|
IDE 测试技术 程序员
|
8月前
|
计算机视觉 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
172 2
|
8月前
|
数据采集 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”解决办法
304 0
|
8月前
|
JSON API 网络架构
Python Web 开发: 解释 Django REST framework 的作用,以及如何定义序列化器(Serializer)?
Python Web 开发: 解释 Django REST framework 的作用,以及如何定义序列化器(Serializer)?
91 0
|
机器学习/深度学习 数据可视化 TensorFlow
ImportError: TensorBoard logging requires TensorBoard with Python summary writer installed.
突然报如下错误,我以为是环境坏掉了,重装环境搞了半天,猜猜最后是什么原因?
291 0
|
机器人 Linux C语言
Linux CentOS下Python+robot framework环境搭建
Linux CentOS下Python+robot framework环境搭建
261 0