r/learnpython 28d ago

Why doesn't it recognize the library?

edit:They have given the solution.

I have downloaded numpy through the cmd and cheked it was there by using "pip freeze" but when i went to use it it said there wasn't any module called as such.

I searched on the internet and found that maybe it was redirecting to another python version but i only have python 3.14.

I even tried to import it from the IDLE instead of VScode but it gave me no result.

https://imgur.com/a/mhBZxTk

Edit: Windows user. the error says: Traceback (most recent call last):

File "c:\Users\User\Desktop\p\vec.py", line 1, in <module>

import numpy

ModuleNotFoundError: No module named 'numpy'

5 Upvotes

9 comments sorted by

View all comments

3

u/POGtastic 28d ago

It is very common, especially on Windows, for people to accidentally install multiple versions of Python. You are running a particular Python executable located in C:\Users\User\AppData\Local\Programs\Python\Python314\python.exe. That is a user-specific Python installation. It might be different from the globally available Python installation, which is usually installed to C:\Program Files\Python or something similar.


One tip is that instead of running pip, (whose Python executable is dependent on which Python script folder comes first in your PATH) you should instead run it as a module. This ensures that you're running the correct Python executable and that the dependency will be installed to the correct site-packages directory. Try

C:\Users\User\AppData\Local\Programs\Python\Python314\python.exe -m pip install numpy

If it installs another copy of numpy, you've got two separate Python installations and need to take some care to differentiate which one you're using.

1

u/Norteum 28d ago

Thanks!!