Mac下pip 9.0 upgrade pip10顯示ImportError: module 'pip' has no attribute 'main'

ImportError: module 'pip' has no attribute 'main' 解決方案

在Mac的硬盤里找到Pycharm CE,右擊“顯示包內容”

contents/helpers/packaging_tool.py路徑鎖定目標文件


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 pip.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 pip.main(['uninstall', '-y'] + pkgs)

轉自https://blog.csdn.net/qq_32618817/article/details/80370153

?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,424評論 0 10
  • 原文 原文下載之后的格式略有點不友好,利用簡述的markdown,編輯一下.版權歸原作者 PEP Index > ...
    大飛哥閱讀 2,529評論 0 0
  • 先創建服務端的APP 1.官網下載Winrun4j。http://winrun4j.sourceforge.net...
    Alex_1799閱讀 1,791評論 1 2
  • ~~~只需要引爆,無需添加!在契約下成長!!加油?_? 體驗入: 直接面對現在的問題就已經化解99%了,現在的改革...
    能量在此閱讀 370評論 1 1
  • 你是 一只輕靈的蟋蟀 初秋里 吱吱吱吱地歌唱 在雨后的夜晚 在我的紗窗外 你頑皮的姿態 在綠葉間躥躍 撩動了我的歡...
    雙槍老太閱讀 223評論 0 1