问题描述
任何帮助将不胜感激。我正在尝试一个简单的代码。文件名也是main.py,我正在通过cmd运行它。我也曾尝试通过蜘蛛和Pycharm运行它,但是没有用。我在做什么错了?
import multiprocessing
import time
if __name__ == '__main__':
def square(x):
return x * x
pool = multiprocessing.Pool()
result_async = [pool.apply_async(square,args = (i,)) for i in range(5)]
results = [r.get() for r in result_async]
print("Output: {}".format(results))
但这会产生以下错误-
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)