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