- Linux下打开 /opt/pycharm-xxxxx/helpers/packaging_tool.py
windows下打开 C:\Program Files\JetBrains\PyCharm 2017.1.1\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:
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:
from pip._internal import main
except Exception:
from pip import main
except ImportError:
error_no_pip()
return main(['uninstall', '-y'] + pkgs)
- 此时打开pycharm 就能加载到pip安装包了。