2

Pip doesn't work in my virtual environment. As I create a virtual env, it works fine for the first time, and it doesn't seem to work the next time. Even after I upgrade pip to the latest version, it throws the same error. How may I solve this issue?

pip freeze Traceback (most recent call last): File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in run_code exec(code, run_globals) File "D:\Fast\name\venv\Scripts\pip.exe_main.py", line 4, in ModuleNotFoundError: No module named 'pip'

1 Answers1

4

On Windows, follow these steps: (Works for Python 3.6 and above)

  1. Download this file: https://bootstrap.pypa.io/get-pip.py
  2. Open cmd, go to the path where the file is downloaded and run the following command:
    python3 get-pip.py --force-reinstall
    

Verify if pip is re-installed:

pip3 -V

[These generic steps should work on any OS!]

anurag
  • 1,715
  • 1
  • 8
  • 28