Python的多进程错误

有时会遇到此类问题

RuntimeError:

        An attempt has been made to start a new process before the

        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your

        child processes and you have forgotten to use the proper idiom

        in the main module:

            if __name__ == '__main__':

                freeze_support()

                ...

        The "freeze_support()" line can be omitted if the program

        is not going to be frozen to produce an executable.

只需要在所运行的代码前面加上if __name__=="__main__":

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • The Inner Game of Tennis W Timothy Gallwey Jonathan Cape ...
    网事_79a3阅读 12,297评论 3 20
  • 为什么要服务他人 那些凭借心意和智力控制住感官的人,会利用行动器官从事瑜伽即无私服务而不执着,他们是人中翘楚。 履...
    FineYogaYuki阅读 506评论 0 0
  • 不知道自己的将来 会埋葬在哪一首诗里 或许是一片秋叶 也或许是一场春天的雨 . 浓稠浅淡的生活着 不想把生命过成了...
    水摇绢阅读 233评论 0 0
  • 在于男生相处过程️有哪些小技巧 让关系变得自然舒服 ?而不会老是让你觉得他对你有好感……
    blablabla_8990阅读 149评论 0 0
  • 昨晚上,女儿抱着一摞书到我房间里来,说:妈妈我又过来了!我正转呼啦圈呢:过就过呗,反正你不说话,不影响到我就...
    茹梦_f8a2阅读 329评论 4 11