0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

pip update 後に ModuleNotFoundError: No module named pip が発生する

0
Posted at

この記事は過去のエラー解決メモを整理したものです。
現在の推奨手順とは異なる可能性があります。
公式ドキュメントを確認して最新情報と差分がないかを確認してください。

事象

VSCodeのターミナル(cmd)で pip update を実行したところ、管理者権限がなく更新に失敗した。その後、pip -V も実行できなくなった。

D:\programs>pip -V
Traceback (most recent call last):
  File "d:\python\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\python\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\python\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'

環境

  • Windows 10
  • Python 3.9系
  • pip
  • VSCode 1.61.2
  • VSCodeターミナル(cmd)

原因

  • pipの更新に失敗したことで、pip本体が壊れた、または削除された状態になっていた。

対策

  1. get-pip.py をダウンロードする。
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  1. get-pip.py を実行する。
py get-pip.py

参考情報

【Python】pipのインストール【Mac/Windows】|ゆうまるブログ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?