[Solved] DeprecationWarning: the imp module is deprecated in favour of importlib

DeprecationWarning: the imp module is deprecated in favour of importlib

The reason for this problem is that the imp library is abandoned after Python 3.4 and the importlib library is used, so we can change the source file of our compiler pycham

In this directory, C:\pycharm 5.0 4\helpers\pycharm (check according to your installation path) has two files

1. docrunner.py

2. utrunner.py

1. Comment out imp, import importlib

2. Comments imp.load_Source, use importlib machinery.Sourcefileloader load module

#import imp
import importlib


#module = imp.load_source(moduleName, fileName)
module = importlib.machinery.SourceFileLoader(moduleName, fileName).load_module()

Similar Posts: