AttributeError: module ‘pip’ has no attribute ‘main’

Detailed map traversal, teach you to master the complex gremlin query debugging method>>>

Pychar is running PIP installation module. The error is as follows:

Solution:

Find packaging in the installation path_ The tool.py file is modified as follows:

My path is D: program files, JetBrains, pychar 2017.2.3, helpers, packaging_ tool.py

Originally:

After modification, save and exit

The code is as follows:

def do_install(pkgs):
    try:
        try:
            from pip._internal import main
        except Exception:
            from pip import main 
        #import pip
    except ImportError:
        error_no_pip()
    return main(['install'] + pkgs)


def do_uninstall(pkgs):
    try:
        try:
            from pip._internal import main
        except Exception:
            from pip import main 
        #import pip
    except ImportError:
        error_no_pip()
    return main(['uninstall', '-y'] + pkgs)

Note: return has no pip, and then indents

Similar Posts: