zoukankan      html  css  js  c++  java
  • 解决pycharm问题:module 'pip' has no attribute 'main'

    今天在用pycharm下载module的时候突然就报错: module 'pip' has no attribute 'main'

    解决办法是找到Pycharm的安装目录下面的Contents/helpers下面的packaging_tool.py

    把do_install 和 do_uninstall两个方法从

    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)

    改成为:

    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)

    重新启动Pycharm,搞定!

  • 相关阅读:
    Eclipse
    Plumtree领跑Web应用
    WebLogic
    BEA的闪电发迹
    BEA:如何破除10亿“魔咒”?
    文档化BPM Studio流程
    Eclipse 快捷键
    BEA Systems将收购Plumtree软件公司
    (TOJ1433)正整数解
    (TOJ3576)找规律
  • 原文地址:https://www.cnblogs.com/diaolanshan/p/9010758.html
Copyright © 2011-2022 走看看