I seem to be stuck with trying to run python3 files in vscode. I have noticed the Triangle button in the top right hand side to run code is no longer coloured green too.
I have set up my own venv for python3 and have installed the numpy package - I've checked pip list
and it's there and runs fine when called any methods from this package upon importing it.
When i right click the file in vscode and click on Run Python File in Terminal - it runs perfectly fine and gives me the desired outputs.
However, when I click Run Code or Alt+shift+N it opens up the Output tab next to the terminal and produces no output - just an error message stating that the module numpy does not exist.
I do not understand this, since the numpy pacakge is installed. Can anyone try and help me with this - because it is quite tiring having the right click all the time and click "run python file in the terminal" i was hoping for a keyboard shortcut instead.
I've attached my code below
import numpy as np
print(np.round(5/30,decimals=3))
Please see the following screen captures.
You can clearly see the output running correctly in when Python3 file is sent to the terminal - but in the OUTPUT tab it's an error!
The above is the correct result from the Terminal
Below is the result of the OUTPUT tab.
Solved it myself - the answer was simply here:
How to execute Python code from within Visual Studio Code
I needed to change the path of the code-runner in the settings.json file as that was activated.