解决pycharm 无法加载pip安装包报错:python packing tools not found. install packing tools

版权声明:属本人原创内容,转载需声明。 https://blog.csdn.net/JJandYY135/article/details/83240538
  1. Linux下打开 /opt/pycharm-xxxxx/helpers/packaging_tool.py
    windows下打开 C:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\packaging_tool.py
  2. 找到下方代码:
def do_install(pkgs):
    try:
        import pip
    except ImportError:
        error_no_pip()
    return pip.main(['install'] + pkgs)

def do_uninstall(pkgs):
   try:
        import pip
    except ImportError:
        error_no_pip()
    return pip.main(['uninstall', '-y'] + pkgs)
  1. 修改为:
def do_install(pkgs):
    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: 
        from pip._internal import main 
    except Exception: 
        from pip import main 
    except ImportError: 
        error_no_pip() 
    return main(['uninstall', '-y'] + pkgs)
  1. 此时打开pycharm 就能加载到pip安装包了。

猜你喜欢

转载自blog.csdn.net/JJandYY135/article/details/83240538
今日推荐