当我在导入sklearn这个库的时候,程序抛出了一个丢弃警告,它的意思是在版本更新后imp库已经不用了,用importlib来代替这个库
Warning (from warnings module):
File "C:Users33171AppDataLocalProgramsPythonPython37libsite-packagessklearnexternalsjoblibexternalscloudpicklecloudpickle.py", line 47
import imp
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
因此解决方案就是把它的文件路径copy下来,C:Users33171AppDataLocalProgramsPythonPython37libsite-packagessklearnexternalsjoblibexternalscloudpickle
打开它,然后把cloudpickle.py文件里面的
import imp -->改成 import importlib
from __future__ import print_function import dis from functools import partial import importlib #更改之前是 import imp import io import itertools import logging import opcode import operator import pickle import struct import sys import traceback import types import weakref