Python rpy2 and matplotlib conflict when using multiprocessing

前端 未结 5 1827
误落风尘
误落风尘 2021-02-07 14:14

I am trying to calculate and generate plots using multiprocessing. On Linux the code below runs correctly, however on the Mac (ML) it doesn\'t, giving the error below:



        
5条回答
  •  渐次进展
    2021-02-07 15:14

    I had a similar issue and found that setting the start method in multiprocessing to use forkserver works as long as it comes after your if name == main: statement.

    if __name__ == '__main__':
        multiprocessing.set_start_method('forkserver')
        first_process = multiprocessing.Process(target = targetOne)
        second_process = multiprocessing.Process(target = targetTwo)
        first_process.start()
        second_process.start()
    

提交回复
热议问题