Pycharm升级pip

时间:2024-03-28 15:52:52

对于一个Python初学者,实在走了很多弯路,最近需要yong用Flask,Pycharm给我带来了很多便利,但是当我想要通过pycharm安装Flask-Bootstrap时,总是提醒如下错误:You are using pip version 10.0.1,however version 18.0 is available.

Pycharm升级pip

依样画葫芦输入 python -m pip install --upgrade pip,得到如下结果

Collecting pip
  Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
  Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
  File "F:\PycharmProject\PythonBook\Code3_1\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip\_internal\basecommand.py", line 228, in main
    status = self.run(options, args)
  File "F:\PycharmProject\PythonBook\Code3_1\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip\_internal\commands\install.py", line 335, in run
    use_user_site=options.use_user_site,
  File "F:\PycharmProject\PythonBook\Code3_1\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip\_internal\req\__init__.py", line 49, in install_given_reqs
    **kwargs
  File "F:\PycharmProject\PythonBook\Code3_1\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip\_internal\req\req_install.py", line 748, in install
    use_user_site=use_user_site, pycompile=pycompile,
  File "F:\PycharmProject\PythonBook\Code3_1\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip\_internal\req\req_install.py", line 961, in move_wheel_files
    warn_script_location=warn_script_location,
  File "F:\PycharmProject\PythonBook\Code3_1\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip\_internal\wheel.py", line 431, in move_wheel_files
    generated.extend(maker.make(spec))
  File "F:\PycharmProject\PythonBook\Code3_1\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 403, in make
    self._make_script(entry, filenames, options=options)
  File "F:\PycharmProject\PythonBook\Code3_1\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 307, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "F:\PycharmProject\PythonBook\Code3_1\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 243, in _write_script
    launcher = self._get_launcher('t')
  File "F:\PycharmProject\PythonBook\Code3_1\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 382, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'
就这样失败了!一阵搜索,有网友提示解释器配置那试试。即如下图:

Pycharm升级pip

神奇的pip已经是18.0版了,但还是不能用。通过刚才的报错

Pycharm升级pip

我们能够知道pip10所在路径,找到它,然后hen狠心地删掉它。把刚才升级起来的18.0也删掉。

Pycharm升级pip

设置如下图,已不见pip的踪影。

Pycharm升级pip

提示,packaging tools not found,点击后面的install packaging tools进行安装,安装完成后再次出现pip。

Pycharm升级pip

再次运行>python -m pip install --upgrade pip,便可完成pip升级。

Pycharm升级pip