Python 多处理不将示例代码打印到标准输出

Python multiprocessing not printing example code to stdout

我正在从 Python multiprocessing Process documentation.

中完全复制这段代码
from multiprocessing import Process

def f(name):
    print('hello', name)

if __name__ == '__main__':
    p = Process(target=f, args=('bob',))
    p.start()
    p.join()

我希望当它 运行 处于 IDLE 状态时,我会看到“hello bob”回来。相反,我什么也得不到。检查 p 变量显示正常的退出代码。

============= RESTART: C:/Users/Hoofran/Desktop/DemoMultiProcess.py ============
>>> p
<Process name='Process-1' pid=17268 parent=18116 stopped exitcode=0>
>>> 

这就是多处理应该如何工作,抑制标准输出吗?如果是这样,为什么文档没有提到这一点?我在这里错过了什么?

这似乎是 IDLE 特定的问题。跨多台机器的重复问题。 运行 in IDLE python 3.8.3 不打印任何行,但命令行中的 运行 按预期打印。

PS C:\Users\ryan.mcgrath\Desktop> cat .\simpleMultiprocessing.py
from multiprocessing import Process

def f(name):
    print('hello', name)

if __name__ == '__main__':
    p = Process(target=f, args=('bob',))
    p.start()
    p.join()


PS C:\Users\ryan.mcgrath\Desktop> python .\simpleMultiprocessing.py
hello bob
PS C:\Users\ryan.mcgrath\Desktop> python
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>