在Mac OSX上使用多处理时,IDLE崩溃 [英] IDLE crash when using multiprocessing on Mac OSX

查看:136
本文介绍了在Mac OSX上使用多处理时,IDLE崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在Python 2.7.8的IDLE中运行此简单代码,它将弹出一个窗口,显示程序仍在运行!您要杀死它吗?".

If I run this simple code in IDLE in Python 2.7.8, it will pop a window saying "The program is still running! Do you want to kill it?".

from multiprocessing import Pool

def foo(x):
    return x**2

if __name__ == '__main__':
    pool = Pool(2)
    pows = pool.map(foo, range(10))
    print pows

即使我杀了还是不杀(它会问两次),都不会发生.我曾经使用Windows,最近才刚开始使用Mac OSX(10.9.4),但我不知道这里是否缺少任何内容.

Even if I do kill or not (it will ask twice) nothing will happen. I used to use Windows and I've just recently started using Mac OSX (10.9.4), and I don't know if I'm missing something here.

如果我直接在终端的Python Shell中运行相同的代码,它将运行良好.在iPython笔记本中也是如此.它只是不会显示在IDLE上,弹出该消息框.

If I run the same code directly in the Python Shell in terminal, it will run fine. Same in iPython notebook. It just won't on IDLE, popping up that message box.

有什么想法吗?我想继续使用IDLE ...

Any ideas? I'd like to keep using IDLE...

这是日志:

INFO:root:10221: Started process
INFO:root:10221: Defined foo
INFO:root:10221: __name__ == '__main__'
INFO:root:10221: pool created

推荐答案

这是以前版本的Pycharm的一个已知问题.如果现在升级到最新版本,则可以在IDE的控制台中安全地使用多处理功能,而不必再运行此问题.

This was a known issue with the previous version of Pycharm. If you upgrade with the latest version now you can safely use multiprocessing within the console of the IDE without running in this issue any longer.

有关更多信息,请参见此处: https://youtrack.jetbrains.com/issue/PY -14969

See here for further informations: https://youtrack.jetbrains.com/issue/PY-14969

这篇关于在Mac OSX上使用多处理时,IDLE崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆