Pycharm 报错 AttributeError: module 'pip' has no attribute 'main'

1.打开文件packaging_tool.py:

  D:\Program files\pycharm\PyCharm 2016.3.2\helpers\packaging_tool.py

2.添加导入:

  import pip._internal as pip_new

3.修改参数

  修改前的代码为:  

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
except ImportError:
error_no_pip()
return pip_new.main(['install'] + pkgs) def do_uninstall(pkgs):
try:
import pip
except ImportError:
error_no_pip()
return pip_new.main(['uninstall', '-y'] + pkgs)
上一篇:不用的代码,存一份--用tornado实现的websocket


下一篇:C语言 复杂队列(链表队列)