美文网首页
Python的多进程错误

Python的多进程错误

作者: 每天必吃香菜 | 来源:发表于2019-12-27 10:50 被阅读0次

    有时会遇到此类问题

    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__":

    相关文章

      网友评论

          本文标题:Python的多进程错误

          本文链接:https://www.haomeiwen.com/subject/qunroctx.html