I am currently working in VSCode and attempting to import various libraries into my file. I am currently using the interpreter image of interpreter. The remainder of my code is shown remainder of code. I do not understand why my numpy is unable to be imported.
Asked
Active
Viewed 2,528 times
1
-
Have you installed numpy? Try running `python -m pip install numpy` and then running your script again. – picobit Oct 21 '22 at 16:12
-
1Does the code actually fail to run, or is this just a visual bug? If it fails, what is the complete error message? Post it as code, NOT an image. – BeRT2me Oct 21 '22 at 16:20
-
@JialeDu I was not aware of this-thank you. Truthfully, no I cannot seem to solve the problem using any of the given suggestions. I have no doubt the solutions work, but none have done the trick for me. I will continue working on each solution and looking at related posts, but I haven't found anything yet. I will keep this post reflective of whether or not I am resolved with the issue-thank you again. – Elias Lind Oct 29 '22 at 13:49
2 Answers
3
Use the following code to print the current interpreter environment,
import sys
print(sys.executable)
Copy the interpreter path and install numpy with
C:\WorkSpace\pytest10\.venv\Scripts\python.exe -m pip install numpy
Modify C:\WorkSpace\pytest10\.venv\Scripts\python.exe
to the path you get

JialeDu
- 6,021
- 2
- 5
- 24
0
Do Ctrl + Shift + P, then in the pop-up type select python interpreter and choose the same python version where you installed numpy package.
-
I am going to reinstall my python interpreter, but I thought numpy was a package that I imported and not installed? – Elias Lind Oct 22 '22 at 17:07