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

    Mac平台下找到packaging_tool.py(如果其他平台可以按报错查这个文件目录及文件。)

    URL:/Applications/PyCharm.app/Contents/helpers/packaging_tool.py

    好久没打开PyCharm创建项目了,今天打开突然报了一个“AttributeError: module 'pip' has no attribute 'main'”查了资料才知道怎么解决。

    vim /Applications/PyCharm.app/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:
            #import pip
            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
            try:
                from pip._internal import main
            except Exception:
                from pip import main
        except ImportError:
            error_no_pip()
        return main(['uninstall', '-y'] + pkgs)
     
  • 相关阅读:
    1028. Hanoi Tower Sequence
    sicily 1063. Who's the Boss
    ubuntu 12.04 x86_64:java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons
    ubuntu12.04 desktop默认无ssh支持
    取消putty右键粘贴功能
    gcc编译参数之m32 m64
    Invalid command 'RailsBaseURI'
    Ubuntu 12.4 server 安装 redmine
    查看Samba用户的方法
    【转】windows浏览共享切换用户登录的方法
  • 原文地址:https://www.cnblogs.com/peng-lan/p/9605099.html
Copyright © 2011-2022 走看看