[Python] Python: "Module Not Found Error" in Virtual environment

Discussão em 'Python' iniciado por Stack, Setembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    I'm a newbie with Python and been trying to install modules using pip unsuccessfully in my small project.

    Following advice online, I've created my own virtual environment and imported my first module cowsay fine. I can definitely see the module being installed in my project:

    [​IMG]

    BUT, when attempting to run the file in my terminal, I keep getting a ModuleNotFoundError.

    (env) sr@python-virtual-env >> pip install cowsay
    Collecting cowsay
    Using cached cowsay-5.0-py2.py3-none-any.whl
    Installing collected packages: cowsay
    Successfully installed cowsay-5.0

    (env) sr@python-virtual-env >> python say.py John
    Traceback (most recent call last):
    File "/Users/sr/Sites/python-virtual-env/say.py", line 1, in <module>
    import cowsay
    ModuleNotFoundError: No module named 'cowsay'


    What am I missing here? Thanks in advance!

    Continue reading...

Compartilhe esta Página