解决pycharm AttributeError: module 'pip' has no attribute 'main'问题

打开安装文件下PyCharm 2017.3.2\helpers\packaging_tools.py

找到do_install方法

修改如下:

def do_install(pkgs):
    try:
        try:
            from pip._internal import main
        except Exception:
            from pip import main
    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
    except ImportError:
        error_no_pip()
    return main(['uninstall', '-y'] + pkgs)

注意返回值去掉pip.

还有注意空格和tab的区别

之后就可以安装了

猜你喜欢

转载自blog.csdn.net/java_ying/article/details/81224915