[Python] Visual Studio Code not letting me choose Virtual environment Python

Discussão em 'Python' iniciado por Stack, Fevereiro 26, 2025.

  1. Stack

    Stack Membro Participativo

    This is a bug I cannot wrap my head around. I should first mention that everything works perfectly on PyCharm notebook Professional Edition (but I prefer VSCode's way of using notebooks).

    When I click on Select Kernel, I only see my two base Python environments. Both work. I would however like to use one of my virtual environment. So I used the >Python: Select Interpreter option: [​IMG]

    Here, it's easy for me to find the path/to/python.exe of my virtual environment (Python 3.12.5) by clicking on Enter interpreter path: [​IMG]

    However, when I click and locate path/to/python.exe, nothing happens. [​IMG]

    There is still the Select Kernel button saying that I have not selected any Python environment for my notebook.

    Things I did:

    • I restarted my computer.
    • I uninstalled VSCode, and reinstalled VSCode.
    • I looked for Windows Updates.
    • I looked for VSCode Updates. None were found. I'm on 1.97.2.
    • I installed ipykernel to my virtual environment but it was already installed.
    • I made sure I had the Python extension enabled on VSCode.
    • I made sure I had the jupyter extension enabled on VSCode.
    • I made sure the base environments worked as expected when choosing them in Select Kernel. They did.
    • I made sure everything worked with my virtual environments in PyCharm Professional. They did.
    • I used python3 -m ipykernel install --user --name=projectname.

    Continue reading...

Compartilhe esta Página