[Python] VS Code doesn't change the virtual environment

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

  1. Stack

    Stack Membro Participativo

    I have a weird problem with python and vs code. I installed the package and I made sure it was installed in the same environment I'm using and when I imported it by import aiohttp, the imported module doesn't have a wavy underline, it instead highlights green, which indicates that vs code can find the package and can see it, but then I run the program, the output gives me ModuleNotFoundError: No module named 'aiohttp' error.

    Photo 1:

    [​IMG]

    Photo 2:

    [​IMG]

    The first one is what I have and the second one is when I intentionally create a module that doesn't exist. In the first photo it imports correctly and doesn't give "problems" but yet both of them have the same outcome if executed: ModuleNotFoundError

    The one I use:

    import aiohttp

    print(aiohttp.__file__)


    The one I made up:

    import aiohttp232323

    print(aiohttp232323.__file__)


    Error code:

    Traceback (most recent call last):
    File "c:\Official_SalvadorGPT\test.py", line 1, in <module>
    import aiohttp
    ModuleNotFoundError: No module named 'aiohttp'


    I also activated it in the terminal but it doesn't help.

    Continue reading...

Compartilhe esta Página