解决PyCharm问题:module ‘pip’ has no attribute ‘main’
更新pip之后,PyCharm安装package出现如下报错:
module 'pip' has no attribute 'main'
找到安装目录下helpers/packaging_tool.py
文件,修改如下代码:
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 pip.main(['install'] + pkgs)
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 pip.main(['uninstall', '-y'] + pkgs)
return main(['uninstall', '-y'] + pkgs)
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/04/01/pycharm-problem-module-pip-has-no-attribute-main/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
解决PyCharm问题:module ‘pip’ has no attribute ‘main’
更新pip之后,PyCharm安装package出现如下报错:
module 'pip' has no attribute 'main'
找到安装目录下helpers/packaging_tool.py文件……
文章目录
关闭
共有 0 条评论