Numpy ModuleNotFoundError on pyenv python environment with Numpy installed

294 views Asked by At

I'm rather new to coding, so please bare with me if I'm not using the optimal terminology to ask this question. I've installed and set up python on my Mac using pyenv based on the following link:

https://opensource.com/article/19/5/python-3-default-mac

I'm currently trying to execute a program, but I receive a ModuleNotFoundError on Numpy upon execution.

Traceback (most recent call last): 
File "<pyshell#0>", line 1, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy'

I've checked via terminal and ensured numpy is installed, I went through the pyenv source files and confirmed numpy is there, and tried the "python -mpip install numpy" method to no avail. I'm not sure what to do at this point, so any of your suggestions would be greatly appreciated! Thank you!

1

There are 1 answers

0
Marcelo Moraes On

Try to check the pip location with the command

pyenv which pip

And use the output to install numpy in the correct environment, for example:

C:\Users\username\.pyenv\pyenv-win\versions\3.10.5\Scripts\pip.exe install numpy

You can, alternatively, fix the "pip" alias as suggested here.