解决pyCharm安装第三方库问题

  1. 找到pyCharm安装包下的packaging_tool.py
  2. 我的是这个路径:PyCharm Community Edition 2017.2.1\helpers\packaging_tool.py
  3. 然后找到def do_install(pkgs):     def do_uninstall(pkgs):这两个函数把下面替换复制上,就可以安装第三方库了。

 


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



 

  
 

你可能感兴趣的:(解决pyCharm安装第三方库问题)