-1

I am using the VSC Editor, Python 3.9.4 and Windows 10. I have installed a virtual environment in my news folder by performing the following steps:

  1. navigated to the news folder.
  2. entered: $ python -m venv .venv
  3. entered: $ .venv\Scripts\activate.bat
  4. At bottom left of VSC Editor, clicked environment link and selected .venv\Scripts\python.exe It now displays: Python 3.9.4 64-bit ('.venv'; venv)

However, when I entered: pip list at the command prompt, I expected to see only 2 files listed, but I am seeing all the installed extensions here. What am I doing wrong?

katcode
  • 1
  • 2
  • If you have both Python 2 and 3 installed you should use pip3 list to list everything for Python 3 – Sefan Aug 26 '21 at 14:14

1 Answers1

0

I am going to guess here that you ran pip list in a command prompt that has not been "activated" (.venv/Scripts/activate.bat or .venv/Scripts/activate.ps1). A command prompt that has not been activated will read what packages it has installed from the global site, not the local virtual site.

First, you need to make sure if you are in either a PowerShell prompt or a CMD prompt and call the appropriate activation script.

CMD -> .bat 
PS  -> .ps1

Once it is activated, you should see your terminal line change to have the environment name prefixed: (.venv) C:\. Now you should be able to run pip list with the expected output.