简体   繁体   English

Python 意外退出

[英]Python quit unexpectedly

Can anybody help with this?有人可以帮忙吗? Whenever I try to launch tkinter, i get this report:每当我尝试启动 tkinter 时,都会收到以下报告:

Process: Python [1106] Path:进程:Python [1106] 路径:
/Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python Identifier: org.python.python Version: 3.5.1 (3.5.1) Code Type: X86-64 (Native) Parent Process: /Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python 标识符:org.python.python 版本:3.5.1 (3.5.1) 代码类型:X86-64(本机)父进程:
Python [1036] Responsible: Python [1036] User ID: Python [1036] 负责人:Python [1036] 用户 ID:
501 501

Date/Time: 2016-04-28 00:14:59.804 -0500 OS Version:日期/时间:2016-04-28 00:14:59.804 -0500 操作系统版本:
Mac OS X 10.10.5 (14F1713) Report Version: 11 Anonymous UUID: Mac OS X 10.10.5 (14F1713) 报告版本:11 匿名 UUID:
8A5EA9E5-B94F-6C3F-2F7E-EC33C5FA8E26 8A5EA9E5-B94F-6C3F-2F7E-EC33C5FA8E26

Time Awake Since Boot: 4900 seconds启动后唤醒时间:4900 秒

Crashed Thread: 0 Dispatch queue: com.apple.main-thread崩溃线程:0 调度队列:com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes:异常类型:EXC_BAD_ACCESS (SIGSEGV) 异常代码:
KERN_INVALID_ADDRESS at 0x00007fff5afffff8 KERN_INVALID_ADDRESS 在 0x00007fff5afffff8

VM Regions Near 0x7fff5afffff8: mapped file 000000010a37f000-000000010a409000 [ 552K] rw-/rwx SM=COW /System/Library/Fonts/Monaco.dfont --> __UNIXSTACK 00007fff5b000000-00007fff5c000000 [ 16.0M] rw-/rwx SM=COW /Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python VM附近区域0x7fff5afffff8:映射文件000000010a37f000-000000010a409000 [552K] RW- / RWX SM = COW /System/Library/Fonts/Monaco.dfont - > __UNIXSTACK 00007fff5b000000-00007fff5c000000 [16.0M] RW- / RWX SM = COW /库/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python

If you are using Homebrew , you can reinstall a corrupted Python environment like this:如果您使用的是Homebrew ,则可以像这样重新安装损坏的 Python 环境:

brew uninstall --ignore-dependencies --force python python@2
unset PYTHONPATH
brew install python python@2

I had another "quit unexpectedly" issue and this resolved it for me.我有另一个“意外退出”问题,这为我解决了。

Python quit unexpectedly when running the code below on my Mac (OS X Yosemite):在我的 Mac (OS X Yosemite) 上运行以下代码时,Python意外退出

root.config(menu_Bar = file_Menu)


# Tkinter GUI Menu

from tkinter import *

### Functions ###

# Do Nothing
def do_Nothing():
    print('I just did... nothing')



### Create tkinter window ###

# Create Window
root = Tk() 



#### Creating the Menu(s) ###

# Create the Menu Bar
menu_Bar = Menu(master = root)

# Create File Menu
file_Menu = Menu(master = menu_Bar)



### Displaying the Menu(s) ###

# Display Menu Bar
root.config(menu = menu_Bar)

# Display File Menu
menu_Bar.add_cascade(label = 'File', menu = file_Menu)




### File Menu Properties ####

# New
file_Menu.add_command(label = 'New', command = do_Nothing)

# Open
file_Menu.add_command(label = 'Open', command = do_Nothing)

# Exit
file_Menu.add_command(label = 'Exit', command = root.quit) 




### Display tkinter window ###
root.mainloop()


# Display Menu Bar
root.config(menu = menu_Bar)

The issue that made Python quit unexpectedly was that instead of导致 Python意外退出的问题是,而不是

# Display Menu Bar
root.config(menu = menu_Bar)

I had originally wrote something like:我最初写的是这样的:

# Display Menu Bar
root.config(myMenu = menu_Bar)

In addition to that, I had to update the Tlc from version Apple 8.5.9 to ActiveTcl 8.5.18.0 .除此之外,我必须将 Tlc 从版本Apple 8.5.9更新到ActiveTcl 8.5.18.0 The website for this is here: https://www.python.org/download/mac/tcltk/#activetcl-8-5-18-0这个网站在这里: https : //www.python.org/download/mac/tcltk/#activetcl-8-5-18-0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM