2014-03-07 63 views
0

我正在面对python多处理中这个好奇的Manager()调用问题。当我通过shell正常调用我的程序时,它一切正常。但用cx_freeze构建的同样的东西失败了。代码示例如下:Manager()通过python工作,但在cx_freeze构建环境中失败

from multiprocessing import Pipe, Manager, Queue 
if conf.shared_dict == None: 
    manager = Manager() 
    conf.shared_dict = manager.dict() 
    conf.shared_dict['seed'] = 0 
parent_conn, child_conn= Pipe() 

The failure happens in Manager() call and following is the stack trace. 

File C:\Users\data-sync\service_api.py, line 93, in message_broker 
    manager = Manager() 
File C:\Python27\lib\multiprocessing\__init__.py, line 99, in Manager 
    m.start() 
File C:\Python27\lib\multiprocessing\managers.py, line 528, in start 
    self.address = reader.recv() 
EOFError 

回答

1

已解决。我没有打电话

multiprocessing.freeze_support() 

加入此项后效果很好。

相关问题