[Python] VS Code doesn't open Python virtual environment

Discussão em 'Python' iniciado por Stack, Julho 14, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using Python 3.13.5 with VS Code 1.102.0 on Ubuntu 24.04.2. With VS Code updates, there were often problems with opening venv environment, but usually reloading VS Code was sufficient to make it work. Not with the newest version. Here are the extensions I have installed:

    [​IMG]

    Opening a Python virtual environment project shows that venv is active, both in command prompt and in the bottom bar:

    [​IMG]

    but it is misleading as evidenced by pip list, which lists system Python modules, or deactivate, which fails:

    .venvpaul@cube:~/st-python/test$ pip list
    ...
    ufw 0.36.2
    unattended-upgrades 0.1
    urllib3 2.0.7
    wadllib 1.3.6
    wheel 0.42.0
    xdg 5
    xkit 0.0.0
    .venvpaul@cube:~/st-python/test$ deactivate
    deactivate: command not found
    .venvpaul@cube:~/st-python/test$ source .venv/bin/activate
    (.venv) .venvpaul@cube:~/st-python/test$ pip list
    Package Version
    ------------------ -------
    Levenshtein 0.27.1
    pip 25.1.1
    python-Levenshtein 0.27.1
    RapidFuzz 3.13.0
    (.venv) .venvpaul@cube:~/st-python/test$


    Only after manual activation and getting a weird (.venv) .venv prompt, I can issue commands inside virtual environment. I replicated this behavior on another system with Python 3.12.7 with VS Code 1.102.0 on Ubuntu 22.04.5. How to fix this problem?

    Continue reading...

Compartilhe esta Página