报错信息
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
源代码
import imp
//使用 imp 加载模块
my_module = imp.load_source('module_name', '/path/to/module.py')
解决方法:使用 importlib 重新编写
import importlib.util
import sys
//使用 importlib 加载模块
spec = importlib.util.spec_from_file_location("module_name", "/path/to/module.py")
my_module = importlib.util.module_from_spec(spec)
sys.modules["module_name"] = my_module
spec.loader.exec_module(my_module)