扩展包安装问题:module 'pip' has no attribute 'main'
2018-11-05 13:40
477 查看
找到安装目录下 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)阅读更多
相关文章推荐
- 解决pycharm问题:module 'pip' has no attribute 'main'
- 解决pycharm问题:module 'pip' has no attribute 'main'
- "module 'pip' has no attribute 'main'"&"name pip is not defined"
- Python module 'pip' has no attribute 'main'
- pygame安装问题(1) 'module' object has no attribute 'init'
- pygame安装问题(1) 'module' object has no attribute 'init'
- 环境搭建问题(1):shell中出现module 'pip' has no attribute 'pep425tags'
- ansible安装遇到"AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'"的问题
- AttributeError: module 'numpy' has no attribute 'dtype' 问题
- python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'问题的解决方法
- AttributeError 'module' object has no attribute 'handlers'--Python子模块导入问题
- AttributeError: 'module' object has no attribute 'post'问题
- 【TensorFlow问题】AttributeError:'module' object has no attribute 'mul'
- PyCharm出现module 'matplotlib' has no attribute 'verbose问题!!
- 学习Python csv模块遇到AttributeError: module 'csv' has no attribute 'writer'和写入后出现空格问题
- 使用旧版本tensorflow出现了negative等报错的问题,AttributeError: 'module' object has no attribute 'xxx'"
- AttributeError: ‘module’ object has no attribute’ 问题
- 修复:pip 'module' object has no attribute '_handlerList'
- 'module' object has no attribute 'OP_NO_TLSv1_1'问题解决
- AttributeError: ‘module’ object has no attribute’xxx 问题解决