成功解决ImportError: [joblib] Attempting to do parallel computing without protecting your import on a sy

成功解决ImportError: [joblib] Attempting to do parallel computing without protecting your import on a sy


解决问题

ImportError: [joblib] Attempting to do parallel computing without protecting your import on a system that does not support forking. To use parallel-computing in a script, you must protect your main loop using "if __name__ == '__main__'". Please see the joblib documentation on Parallel for more information

解决思路

导入错误:[joblib]试图在不支持分叉的系统上执行并行计算而不保护导入。要在脚本中使用并行计算,您必须使用"if __name__ == '__main__'"来保护主循环。有关详细信息,请参阅并行的joblib文档。

tips:
1、凡是有调用方法的时候,均会出现该错误!
from sklearn.grid_search import GridSearchCV
因为sklearn.grid_search方法已经有所重构!

解决方法

在主程序最顶部加入主代码即可!

if __name__=='__main__':   #主程序最顶端,加入此行代码即可

哈哈,大功告成!

(0)

相关推荐