[Python] Windows written python script can't import pandas or numpy when run on mac ;...

Discussão em 'Python' iniciado por Stack, Março 13, 2025.

  1. Stack

    Stack Membro Participativo

    I have written a script that depends on importing pandas and random libraries as a first step. However, when I try to run this script in python3 on a Mac computer,

    I think I could just get away with using pandas and without importing numpy at all, but when I do, the same problem occurs, just with pandas instead of numpy. I get the Same ModuleNotFoundError. So there's something wrong with the way that I'm trying to import the libraries.

    I'm confused because everything works fine on multiple windows machines. I can't imagine that numpy or pandas are restricted to Windows only.

    This is how I'm importing the libraries.

    import numpy as np
    import pandas as pd
    import random



    I expect this to import numpy, pandas, and random without comment, but I actually get this error:

    Traceback (most recent call last):
    File "pandasplay.py," line 1, in <module>
    import numpy as np
    ModuleNotFoundError: No module named 'numpy'



    Did something go wrong with installation of python three on the mac? I'm using Python 3.7.3.

    Continue reading...

Compartilhe esta Página