解决pycharm问题:module 'pip' has no attribute 'main'
2018-07-19 09:57
1561 查看
https://blog.csdn.net/yup1212/article/details/80047326
更新pip之后,Pycharm安装package出现报错:module 'pip' has no attribute 'main'
找到安装目录下 helpers/packaging_tool.py文件,找到如下代码:
修改为如下,保存即可。
更新pip之后,Pycharm安装package出现报错:module 'pip' has no attribute 'main'
找到安装目录下 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中matplotlib画图出错问题(AttributeError: module 'matplotlib' has no attribute 'verbose')
- 'module' object has no attribute 'MLPRegressor'问题解决(Python2.7)
- python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'问题的解决方法
- PyCharm出现module 'matplotlib' has no attribute 'verbose问题!!
- 'module' object has no attribute 'OP_NO_TLSv1_1'问题解决
- Tensorflow protobuf版本报错问题解决(AttributeError: 'module' object has no attribute 'Default')
- 关于Python的:'module' object has no attribute 'inet_pton'问题解决
- 关于python里运行出现'module' object has no attribute 'xxxx'等问题解决方法
- python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'问题的解决方法
- AttributeError: 'module' object has no attribute 'face' 问题解决 opencv+python
- pytorch实践中module 'torch' has no attribute 'form_numpy'问题的解决
- 解决问题 AttributeError: 'module' object has no attribute 'face_recognition_model_v1'
- TF版本问题:解决AttributeError: module 'tensorflow' has no attribute 'mul'—Jason niu
- AttributeError: ‘module’ object has no attribute’xxx 问题解决
- Scrapy安装报错:AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'解决办法
- PyQt5系列(三)Python3.x AttributeError: module 'string' has no attribute 'maketrans'错误解决
- openerp.cli.main() AttributeError: 'module' object has no attribute 'cli'
- AttributeError: module 'numpy' has no attribute 'dtype' 问题
- Django报错:AttributeError: 'module' object has no attribute 的解决方法
- pygame安装问题(1) 'module' object has no attribute 'init'