Python 不推荐使用 imp 模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52596204/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 20:08:27  来源:igfitidea点击:

The imp module is deprecated

pythonscikit-learnpycharm

提问by Ekrem Solmaz

Whenever I try to use "sklearn" in pycharm, I get the following error on the console.

每当我尝试在 pycharm 中使用“sklearn”时,我都会在控制台上收到以下错误。

DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp

弃用警告:imp 模块已被弃用,以支持 importlib;请参阅模块的文档以了解替代用途 import imp

I am not sure if it should bother me, because program still working, but it's annoying. How can I get rid of it?

我不确定它是否应该打扰我,因为程序仍在运行,但很烦人。我怎样才能摆脱它?

I made every change, people recommended in linked question but the error is still there.

我做了每一个更改,人们在链接问题中推荐,但错误仍然存​​在。

Thank you

谢谢

采纳答案by Ekrem Solmaz

I deleted the code that imports "imp", from "cloudpickle.py" and the warning is gone but I hope I didn't mess up anything. You can also simply ignore this, since it's not an error.

我从“cloudpickle.py”中删除了导入“imp”的代码,警告消失了,但我希望我没有搞砸任何事情。您也可以简单地忽略这一点,因为这不是错误。