[Python] Why is my virtual environment not working?

Discussão em 'Python' iniciado por Stack, Março 2, 2025.

  1. Stack

    Stack Membro Participativo

    I have a Python virtual environment (created with venv) kept in a directory in my project. I created it and sourced the activate script. I am sure that it worked, because my terminal prompt starts with (venv). Running which pip points to the pip installed in the venv, however, when I run which python3, I get /user/bin/python3 as a result. Also, it is still using my site-packages directory for module sourcing. why is this so?

    OS: Ubuntu 20.04

    When I try to install modules, I get the following error:

    bash:
    /home/ntolb/CODING_PROJECTS/python_workspaces/webscraping-projects_workspaces/scr-proj_ws1/venv/bin/pip: /home/ntolb/CODING_PROJECTS/python_workspaces/webscraping-projects_workspaces/scr-proj_ws1/venv/bin/python:
    bad interpreter: No such file or directory


    even though I can clearly see it in the VS Code file explorer.

    Continue reading...

Compartilhe esta Página