module 'pip' has no attribute 'main'
Posted haimishasha
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了module 'pip' has no attribute 'main'相关的知识,希望对你有一定的参考价值。
摘录自:http://www.cnblogs.com/Fordestiny/p/8901100.html
问题分析:
问题解决:
找到安装目录下 helpers/packaging_tool.py文件
找到如下代码:
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)
以上是关于module 'pip' has no attribute 'main'的主要内容,如果未能解决你的问题,请参考以下文章
解决pycharm问题:module 'pip' has no attribute 'main'
Pycharm问题:module 'pip' has no attribute 'main'
module 'pip' has no attribute 'main'
解决pycharm问题:module 'pip' has no attribute 'main'
pycharm安装第三方库失败module 'pip' has no attribute 'main'
Jupiter 页面环境下使用pip无法安装(AttributeError: module 'pip' has no attribute 'main')