成功解决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__':   #主程序最顶端,加入此行代码即可

哈哈,大功告成!


 


相关文章
|
算法框架/工具
成功解决INFO: pip is looking at multiple versions of keras-preprocessing to determine which version is c
成功解决INFO: pip is looking at multiple versions of keras-preprocessing to determine which version is c
|
3月前
|
Python
A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.0 as it may crash. To support
本文讨论了在NumPy 2.0.0版本更新后可能出现的兼容性问题,并提供了通过降级NumPy版本至1.x的解决方法,以支持尚未更新的模块或库。
|
3月前
|
编译器 API C++
【Matlab】解决使用Mex 报错There was a problem creating the mex file for Real Time Execution ,Please ensure y
解决Matlab使用Mex时出现的"Real Time Execution"错误的步骤,即通过安装"MATLAB 支持 MinGW-w64 C/C++ 编译器"这个包来确保编译器设置正确。
55 0
|
6月前
解决Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com
解决Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com
119 5
|
6月前
|
PyTorch 算法框架/工具
The “freeze_support()“ line can be omitted if the program is not going to be frozen
The “freeze_support()“ line can be omitted if the program is not going to be frozen
103 1
|
虚拟化
成功解决Failed to execute stage ‘Setup validation’: Hardware does not support virtualization.
成功解决Failed to execute stage ‘Setup validation’: Hardware does not support virtualization.
|
TensorFlow 算法框架/工具
成功解决To fix this you could try to: 1. loosen the range of package versions you‘ve specified ​​​​​​​
成功解决To fix this you could try to: 1. loosen the range of package versions you‘ve specified ​​​​​​​
成功解决To fix this you could try to: 1. loosen the range of package versions you‘ve specified ​​​​​​​
E: Unable to correct problems, you have held broken packages.
在使用服务器配置环境中遇到的问题,先将解决方案列下:
|
存储 缓存 Oracle
TPCH 深入剖析 - part1 Hidden Messages and Lessons Learned from an Influential Benchmark
TPC-H可以说是世界上最为流行的OLAP workload的benchmark程序,无论你看什么样的论文或技术文章,只要是和query processing相关的,大多会在evaluation时使用TPC-H作为评估工具。而如果你从事query optimization/query execution的工作,则怎么都会和TPC-H打上交道,即使是TP型的数据库系统。
381 0
TPCH 深入剖析 - part1 Hidden Messages and Lessons Learned from an Influential Benchmark