Pycharm升級pip
對於一個Python初學者,實在走了很多彎路,最近需要yong用Flask,Pycharm給我帶來了很多便利,但是當我想要通過pycharm安裝Flask-Bootstrap時,總是提醒如下錯誤:You are using pip version 10.0.1,however version 18.0 is available.
依樣畫葫蘆輸入 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'
就這樣失敗了!一陣搜尋,有網友提示直譯器配置那試試。即如下圖:
神奇的pip已經是18.0版了,但還是不能用。通過剛才的報錯
我們能夠知道pip10所在路徑,找到它,然後hen狠心地刪掉它。把剛才升級起來的18.0也刪掉。
設定如下圖,已不見pip的蹤影。
提示,packaging tools not found,點選後面的install packaging tools進行安裝,安裝完成後再次出現pip。
再次執行>python -m pip install --upgrade pip,便可完成pip升級。