[Python] How to run python through the terminal using conda installation

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

  1. Stack

    Stack Membro Participativo

    I have created a Python environment and activated it using conda. Now I want to run a simple script that just imports Numpy via python script.py

    import numpy as np
    print(np.zeros(4))


    But I get the following error

    No module named 'numpy'


    Which I don't understand since running conda install numpy gives

    All requested packages already installed.


    Also running pip install numpy gives

    Requirement already satisfied: numpy in /Users/anaconda3/lib/python3.12/site-packages (2.2.1)


    So I am not sure what is happening. Perhaps it is not using conda version when I run python script from the terminal? How can force it to do so?

    Continue reading...

Compartilhe esta Página