AttributeError: module 'pip' has no attribute 'main'如何解决

Source
版权声明:本博客为博主原创,未经博主允许不得转载 https://blog.csdn.net/glittledream/article/details/85063131

由于pip 10版本中没有main(),如果在不降级的情况下,修改这个文件

C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.3\helpers\packaging_tool.py(在你pycharm的安装路径里找

 

#####头部加上
import pip._internal as pip_new

####然后分别修改文件中的这两行中的pip
return pip.main(['install'] + pkgs)
return pip.main(['uninstall', '-y'] + pkgs)



###########为
return pip_new.main(['install'] + pkgs)
return pip_new.main(['uninstall', '-y'] + pkgs)