Python 2.7.11
[达尔文的GCC 4.2.1(Apple Inc. build 5666)(第3点)]
Matplotlib版本:1.5.1
过去两天,我一直在网上搜索python崩溃的原因。我最近在卸载后重新安装了python。现在,我在Tkinter中运行的Matplotlib数字设计的程序不再有效。我已经尝试卸载,然后重新安装matplotlib。 Sublime Text 2中使用终端发生错误。任何帮助,将不胜感激。
崩溃了:
import Tkinter as tk
import matplotlib.pyplot
print tk.Tk()
这不会崩溃:
import Tkinter as tk
print tk.Tk()
import matplotlib.pyplot
这不会崩溃:
import Tkinter as tk
import matplotlib
print tk.Tk()
错误报告:
流程:Python [59603] 路径:/ Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
标识符:org.python.python
版本:2.7.11(2.7.11)
代码类型:X86-64(原生)
父进程:Sublime Text 2 [38025]
负责任:Python [59603]
用户ID:501
日期/时间:2016-03-04 13:05:09.138 -0500
操作系统版本:Mac OS X 10.11(15A278b)
报告版本:11
匿名UUID:816E9B37-C2E8-AB01-CF48-B14EDABDC5DF
睡眠/唤醒UUID:D6FB01E8-81D6-42F3-BF60-D0EE4CA8C9D1
启动后的时间清醒:62000秒 自唤醒以来的时间:12000秒
系统完整性保护:已禁用
Crashed Thread:0 Dispatch queue:com.apple.main-thread
异常类型:EXC_CRASH(SIGABRT) 例外代码:0x0000000000000000,0x0000000000000000 例外注释:EXC_CORPSE_NOTIFY
特定应用信息: ***由于未捕获的异常终止应用程序' NSInvalidArgumentException',原因:' - [NSApplication _setup:]:无法识别的选择器发送到实例0x1007d52d0'
abort()调用以NSException类型的未捕获异常终止
特定应用程序Backtrace 1: 0 CoreFoundation 0x00007fff97416bd2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff936354fa objc_exception_throw + 48
2 CoreFoundation 0x00007fff974800ed - [NSObject(NSObject)doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff973873d1 转发 + 1009
4 CoreFoundation 0x00007fff97386f58 _CF_forwarding_prep_0 + 120
5 Tk 0x0000000101c66958 TkpInit + 476
6 Tk 0x0000000101be1a7e Tk_Init + 1799
7 _tkinter.so 0x0000000101abe9fd Tcl_AppInit + 77
8 _tkinter.so 0x0000000101abc1e5 Tkinter_Create + 997
9 Python 0x00000001000c710c PyEval_EvalFrameEx + 40108
10 Python 0x00000001000c7ff3 PyEval_EvalCodeEx + 2131
11 Python 0x000000010003e1e0 function_call + 176
12 Python 0x000000010000c442 PyObject_Call + 98
13 Python 0x000000010001ec2d instancemethod_call + 365
14 Python 0x000000010000c442 PyObject_Call + 98
15 Python 0x00000001000bc1a7 PyEval_CallObjectWithKeywords + 87
16 Python 0x0000000100021f1e PyInstance_New + 126
17 Python 0x000000010000c442 PyObject_Call + 98
18 Python 0x00000001000bfc73 PyEval_EvalFrameEx + 10259
19 Python 0x00000001000c7ff3 PyEval_EvalCodeEx + 2131
20 Python 0x00000001000c8116 PyEval_EvalCode + 54
21 Python 0x00000001000ed0fe PyRun_FileExFlags + 174
22 Python 0x00000001000ed39a PyRun_SimpleFileExFlags + 458
23 Python 0x000000010010457d Py_Main + 3101
24 Python 0x0000000100000f14 Python + 3860
Thread 0 Crashed :: Dispatch queue:com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff9722a0ae __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff93baf500 pthread_kill + 90
2 libsystem_c.dylib 0x00007fff8706437b abort + 129
3 libc ++ abi.dylib 0x00007fff935d8f81 abort_message + 257
4 libc ++ abi.dylib 0x00007fff935fea47 default_terminate_handler()+ 267
5 libobjc.A.dylib 0x00007fff9363715e _objc_terminate()+ 103
6 libc ++ abi.dylib 0x00007fff935fc19e std :: __ terminate(void(*)())+ 8
7 libc ++ abi.dylib 0x00007fff935fbc12 __cxa_throw + 121
8 libobjc.A.dylib 0x00007fff93635608 objc_exception_throw + 318
9 com.apple.CoreFoundation 0x00007fff974800ed - [NSObject(NSObject)doesNotRecognizeSelector:] + 205
10 com.apple.CoreFoundation 0x00007fff973873d1 转发 + 1009
11 com.apple.CoreFoundation 0x00007fff97386f58 _CF_forwarding_prep_0 + 120
12 Tk 0x0000000101c66958 TkpInit + 476
13 Tk 0x0000000101be1a7e 0x101bb3000 + 191102
14 _tkinter.so 0x0000000101abe9fd Tcl_AppInit + 77
15 _tkinter.so 0x0000000101abc1e5 Tkinter_Create + 997
16 org.python.python 0x00000001000c710c PyEval_EvalFrameEx + 40108
17 org.python.python 0x00000001000c7ff3 PyEval_EvalCodeEx + 2131
18 org.python.python 0x000000010003e1e0 function_call + 176
19 org.python.python 0x000000010000c442 PyObject_Call + 98
20 org.python.python 0x000000010001ec2d instancemethod_call + 365
21 org.python.python 0x000000010000c442 PyObject_Call + 98
22 org.python.python 0x00000001000bc1a7 PyEval_CallObjectWithKeywords + 87
23 org.python.python 0x0000000100021f1e PyInstance_New + 126
24 org.python.python 0x000000010000c442 PyObject_Call + 98
25 org.python.python 0x00000001000bfc73 PyEval_EvalFrameEx + 10259
26 org.python.python 0x00000001000c7ff3 PyEval_EvalCodeEx + 2131
27 org.python.python 0x00000001000c8116 PyEval_EvalCode + 54
28 org.python.python 0x00000001000ed0fe PyRun_FileExFlags + 174
29 org.python.python 0x00000001000ed39a PyRun_SimpleFileExFlags + 458
30 org.python.python 0x000000010010457d Py_Main + 3101
31 org.python.python 0x0000000100000f14 0x100000000 + 3860
线程1 ::调度队列:com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff9722b0a2 kevent_qos + 10
1 libdispatch.dylib 0x00007fff8bd2c1ad _dispatch_mgr_invoke + 216
2 libdispatch.dylib 0x00007fff8bd2be15 _dispatch_mgr_thread + 52
主题2:
0 libsystem_kernel.dylib 0x00007fff9722a78a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff93bac58c _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff93baa375 start_wqthread + 13
主题3:
0 libsystem_kernel.dylib 0x00007fff9722a78a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff93bac58c _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff93baa375 start_wqthread + 13
主题4:
0 libsystem_kernel.dylib 0x00007fff9722a78a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff93bac58c _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff93baa375 start_wqthread + 13
主题5:
0 libsystem_kernel.dylib 0x00007fff9722a78a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff93bac58c _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff93baa375 start_wqthread + 13
主题6:
0 libsystem_kernel.dylib 0x00007fff9722a78a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff93bac58c _pthread_wqthread + 1283
2 libsystem_pthread.dylib 0x00007fff93baa375 start_wqthread + 13
...
型号:MacBookAir6,2,BootROM MBA61.0099.B19,2处理器,Intel Core i5,1.3 GHz,4 GB,SMC 2.13f15
图形:Intel HD Graphics 5000,Intel HD Graphics 5000,内置
内存模块:BANK 0 / DIMM0,2 GB,DDR3,1600 MHz,0x80AD,0x483943434E4E4E384A544D4C41522D4E544D
内存模块:BANK 1 / DIMM0,2 GB,DDR3,1600 MHz,0x80AD,0x483943434E4E4E384A544D4C41522D4E544D
AirPort:spairport_wireless_card_type_airport_extreme(0x14E4,0x117),Broadcom BCM43xx 1.0(7.21.94.23.1a20)
蓝牙:版本4.4.0f4 16320,3个服务,27个设备,1个传入串行端口
网络服务:Wi-Fi,AirPort,en0
串行ATA设备:APPLE SSD SD0128F,121.33 GB
USB设备:USB 3.0总线
USB设备:BRCM20702集线器
USB设备:蓝牙USB主机控制器
USB设备:iPhone
Thunderbolt Bus:MacBook Air,Apple Inc.,23.6
答案 0 :(得分:0)
我发现这个帖子的第一个(也是唯一的)答案解决了我的问题:
Installation Issue with matplotlib Python
详细信息:我在Anaconda Python 2.7发行版中遇到此异常。我在某处读到了matplotlib需要从源代码编译的建议,所以我使用--build-from-source标志切换到自制安装。这产生了一个有用的错误消息,然后我用它来找到上面的线程:
IEnumerator loadData2()
{
string fileDir = Application.persistentDataPath;
int APDIndex = 0; //Only incremented if file exist
APD = new string[numOfSaveFile_O];
loadNum = 0; //File starts at 0
while (loadNum < numOfSaveFile_O)
{
string filePath = fileDir + "/data[" + loadNum + "].octa";
if (File.Exists(filePath))
{
Debug.Log(loadNum);
BinaryFormatter loadData = new BinaryFormatter();
FileStream dataFile = File.Open(filePath, FileMode.Open); //Open File
playerData pData = (playerData)loadData.Deserialize(dataFile);
dataFile.Close();
name_O = pData.name;
job_O = pData.job;
difficulty_O = pData.difficulty;
rawAPD = name_O + "/" + job_O.ToString() + "/" + difficulty_O.ToString();
APD[APDIndex] = rawAPD;
APDIndex++;
}
loadNum++;
yield return null; //Don't freeze Unity
}
}
答案 1 :(得分:0)
在Mac上,您可以使用TkAgg或Qt4Agg作为后端
import matplotlib
matplotlib.use("TkAgg")
或者,如果您安装了QT4,则可以将其用作后端。设置有点复杂。你需要PyQT4或PyQT5。您可以在此处从源代码下载并构建它:https://www.riverbankcomputing.com/software/pyqt/download
请记住,如果您使用PyQT,您还需要下载并构建SIP:https://www.riverbankcomputing.com/software/sip/download
运行
python configure.py
它将构建Makefile,然后make
和make install
。
安装QT4和PyQT4后,您可以将后端设置为Qt4Agg
。我正在使用QT4,效果很好!