我试图在运行OS 10.12.6的Mac上全新安装的Python 3.7.0下,在IDLE下运行脚本,但是一旦击中“ root = Tk()”,它似乎崩溃。
生成的错误是:
Process: Python [877]
Path: /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: 3.7.0 (3.7.0)
Code Type: X86-64 (Native)
Parent Process: Python [872]
Responsible: Python [877]
User ID: 501
Date/Time: 2018-08-08 08:58:47.934 -0400
OS Version: Mac OS X 10.12.6 (16G1510)
Report Version: 12
Anonymous UUID: F9CEC001-40B2-1F01-C918-48794CEB9A07
Sleep/Wake UUID: 6743F7F2-F98A-4114-8742-809CF7F2C43B
Time Awake Since Boot: 22000 seconds
Time Since Wake: 5400 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7fba344e3f60'
abort()被调用 以NSException类型的未捕获异常终止
我已经使用以下方法查询了tcl / tk库:
print(root.tk.exprstring('$tcl_library'))
print(root.tk.exprstring('$tk_library'))
这将报告以下内容:
/Library/Frameworks/Python.framework/Versions/3.7/lib/tcl8.6
/Library/Frameworks/Python.framework/Versions/3.7/lib/tk8.6
鉴于Python.org here上的信息,这似乎是正确的。 我应该怎么做?