1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] VENV does not include pip in newly created environment

Discussão em 'Python' iniciado por Stack, Setembro 16, 2025.

  1. Stack

    Stack Membro Participativo

    I found a number of questions related to my problem but solutions did not really help me. I work on Windows 10 and PowerShell 7, and have currently installed a few Python versions, s.a. 3.11, 3.12 and 3.13. Then, I use launcher py.exe to create virtual environments for different version, since many apps have not been updated to Python 3.13.

    pip is not installed in new environments


    I simply run the following command

    py -m venv .venv


    which creates a new environment in the current folder. The following activates .venv

    .venv\Scripts\Activate.ps1


    A changed prompt to (.venv) PS D ...> demonstrates it's working. I can also confirm that local python version is correctly recognised

    Get-Command python


    The path is correct: <local path>\.venv\Scripts\python.exe.

    Here's the problem. After activating new env, pip is still available as a standalone program but does not work on a local level. If I try to run

    pip install numpy --dry-run


    I get the report

    Requirement already satisfied: numpy in <user>\appdata\local\programs\python\python313\lib\site-packages (2.3.3)


    it clearly indicates pip is not working correctly. I get evidence of it if I run the command

    Get-Command pip


    because the path to pip is

    <User>\AppData\Local\Programs\Python\Python313\Scripts\pip.exe


    which is incorrect.

    Impossible to install new modules


    This leads to the problem of not being able to install new modules in newly created environments because pip is missing. For instance

    python -m pip install pip --upgrade


    issues the error: <local path>\.venv\Scripts\python.exe: No module named pip, while

    Get-Command python


    still demonstrates I am working on a local version of python in virtual environment

    <local path>\.venv\Scripts\python.exe

    ensurepip does not solve the problem


    I tried to search for solutions and found out pip can be installed if I run the following command

    python -m ensurepip


    or

    python -m ensurepip --upgrade


    for some reason this results with the following output

    Requirement already satisfied: pip in <local path>\.venv\lib\site-packages (25.2)


    which would indicate pip was already installed. I run Get-Children -Recurse -Path ".venv/" to see all subdirectories and programs but pip was nowhere to find

    Directory: <Local Path>\.venv

    Mode LastWriteTime Length Name
    ---- ------------- ------ ----
    d---- 16/09/2025 12:20 Include
    d---- 16/09/2025 12:20 Lib
    d---- 16/09/2025 12:20 Scripts
    -a--- 16/09/2025 12:20 71 .gitignore
    -a--- 16/09/2025 12:20 338 pyvenv.cfg

    Directory: <Local Path>\.venv\Lib

    Mode LastWriteTime Length Name
    ---- ------------- ------ ----
    d---- 16/09/2025 12:20 site-packages

    Directory: <Local Path>\.venv\Scripts

    Mode LastWriteTime Length Name
    ---- ------------- ------ ----
    -a--- 16/09/2025 12:20 2208 activate
    -a--- 16/09/2025 12:20 1022 activate.bat
    -a--- 16/09/2025 12:20 2281 activate.fish
    -a--- 06/08/2025 16:16 9031 Activate.ps1
    -a--- 06/08/2025 16:14 393 deactivate.bat
    -a--- 06/08/2025 16:15 255320 python.exe
    -a--- 06/08/2025 16:15 251736 pythonw.exe

    Directory: <Local Path>\__pycache__

    Mode LastWriteTime Length Name
    ---- ------------- ------ ----
    -a--- 29/07/2024 16:12 15096 backup.cpython-312.pyc


    Thanks for reaching the end. I hope someone can help me with that.

    Cheers!

    Continue reading...

Compartilhe esta Página