在Windows中使用Python处理分布式进程时如何解决权限问题?
python 在 windows 中处理分布式进程时遇到权限问题
在使用 python 创建分布式进程时,我们可能会遇到这样的代码:
url_manager=Process(target=url_manager_proc,args=(url))result_solve=Process(target=result_solve_proc,args=())store=Process(target=store_proc,args=())url_manager.start()result_solve.start()store.start()
在这种情况下,需要传递一个对象到 url_manager_proc 函数中,但这样做会导致 permissionerror: [winerror 5] 拒绝访问的错误。原因是该对象无法作为全局变量,而 url_manager_proc 函数需要对象的类型作为形参。
为了解决这个问题,可以使用以下方法:
弃用 windows 10,改用 linux (ubuntu 18.04)
建议使用 linux 系统处理分布式进程,这方面做得更好。
以上就是在 Windows 中使用 Python 处理分布式进程时如何解决权限问题?的详细内容,更多请关注范的资源库其它相关文章!