Skip to content
Advertisement

Running numpy using anaconda and VS Code

I am trying to get VScode to work with anaconda but having issues with numpy. I have managed to get VScode to use the right python environment From VScode (ctrl+shift+P, type Python:Select Interpreter and select the appropriate option).

However, when I type “import numpy” in to my script, I get the following error message:

JavaScript

I have successfully called the ‘import numpy’ command from the anaconda command prompt so it seems the issue is just with VS-Code?

I have also tried to reinstall numpy from the environment with the following command conda install numpy --force-reinstall but this has no effect?

Advertisement

Answer

Try launching VS Code from your activated conda environment. Errors like this typically come up if you managed to run code before your shell had a chance to do a conda environment activation.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement