When I was importing the sklearn library, the program threw a discard warning, which means that after the version update, the imp library is no longer used. Use importlib to replace this library.
Warning (from warnings module):
File “C:\Users \33171\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\externals\joblib\externals\cloudpickle\cloudpickle.py”, line 47
import imp
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module’s documentation for alternative uses< /p>
So the solution is to copy its file path, C:\Users\33171\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\externals\joblib\externals\cloudpickle
Open it, and then change the
import imp –> in the cloudpickle.py file to import importlib
from __future__ import print_function
< span style="color: #0000ff">import dis
from functools import partial
import importlib #Import imp before the change
import io
import itertools
import logging
import opcode
import operator
import pickle
import struct
import sys
import traceback
import types
import weakref
Preview
< img alt="share picture" id="code_img_closed_374ef059-4ce1-4eb0-b784-b919b8f09042" class="code_img_closed" src="/wp-content/uploads/imag es/mobile/rom/1626791909762.gif">
from __future__ import print_function< br />
import dis
from functools import partial
import importlib #Import imp< before the change /span>
import io
impo rt itertools
import logging
import opcode
import operator
import< span style="color: #000000"> pickle
import struct
import sys
import traceback
import types
import weakref
Preview
from __future__ import print_function
import dis
from functools import partial
import importlib #Import imp before the change
import io
import itertools
import logging
import opcode
import operator
import pickle
import struct
import sys
import span> traceback
import types
import weakref