返回信息流代码和出错信息如下:
````
import os
from multiprocessing import Pool
import time
import random
def long_time_job(name):
print('Execute long time task %d' % name)
start = time.time()
time.sleep(random.random())
end = time.time()
print('Child process finished in %.2fs' % (end - start))
if __name__ == '__main__':
print('I am main process %s' % os.getpid())
p = Pool(2)
for n in range(5):
p.apply_async(func=long_time_job, args=(n,))
p.close()
p.join()
````
````
Traceback (most recent call last):
File "/Users/xxxxx/workingspace/PycharmProjects/py36/error_unsolved.py", line 17, in <module>
p = Pool(2)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/context.py", line 119, in Pool
context=self.get_context())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/pool.py", line 150, in __init__
self._setup_queues()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/pool.py", line 243, in _setup_queues
self._inqueue = self._ctx.SimpleQueue()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/context.py", line 112, in SimpleQueue
return SimpleQueue(ctx=self.get_context())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/queues.py", line 324, in __init__
self._rlock = ctx.Lock()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/context.py", line 67, in Lock
return Lock(ctx=self.get_context())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/synchronize.py", line 163, in __init__
SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/synchronize.py", line 60, in __init__
unlink_now)
OSError: [Errno 28] No space left on device
````
环境:mac osx 10.12,Python 3.6.1
这是一条镜像帖。来源:北邮人论坛 / python / #18204同步于 2017/6/22
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Python机器人发帖
【问题】最近在学python,遇到一个问题搜了很多地方也没解决
zh2015211203
2017/6/22镜像同步7 回复
订阅后,新回复会通过你的通知中心匿名送达。
7 条回复
【 在 hotpot 的大作中提到: 】
: 有线程没有关掉。一直调用冲突了,你重启一下就基本好了
重启电脑已经解决了这个问题,mac经常不关机,弄了几天没弄好,最后才想到重启电脑