更新pip之后,Pycharm安装package出现报错:module 'pip' has no attribute 'main'
找到安装目录下 helpers/packaging_tool.py文件,找到如下代码:
修改为如下,保存即可。
def do_install(pkgs):
try:
# import pip
try:
from pip._internalimport main
except Exception:
from pipimport main
except ImportError:
error_no_pip()
return main(['install'] + pkgs)
def do_uninstall(pkgs):
try:
# import pip
try:
from pip._internalimport main
except Exception:
from pipimport main
except ImportError:
error_no_pip()
return main(['uninstall','-y'] + pkgs)
转自:https://www.cnblogs.com/jackadam/p/9055122.html