Issue
I'm trying to run TensorFlow on a virtual environment that I've created and which runs Python 3.6.8 using VS Code (I know anaconda is the preferred way to go but I have to use VS Code). However, when I try to import the package into my .py file, it says that the TensorFlow module cannot be found.
My settings.json file has the following data:
{
"python.pythonPath": "C:\\Users\\user\\Desktop\\AI\\venv36\\Scripts\\python"
}
The above was implemented in accordance with this video: https://www.youtube.com/watch?v=Wuuiga0wKdQ. I know that TensorFlow has been installed since when I go to the virtual environment directory and try to import it within the CLI, it imports the module without any issues.
The TensorFlow module is located in the path: C:\Users\user\Desktop\AI\venv36\Lib\site-packages
But when I put the above path in the settings.json file, it still didn't help.
Solution
Based on the information you provide, please refer to the following:
To use python in VS Code, please make sure that the 'python' extension has been installed.
If you are using a 'Windows' system, you need to use "python.exe" when setting "python.pythonPath".
Please check whether the python environment displayed in the lower left corner of VS Code is consistent with the python environment used by the VS Code terminal.
( If they use different pythons, please use the shortcut key Ctrl+Shift+` to open a new VS Code terminal, it will automatically enter the python environment selected in the lower left corner of VS Code. )
More reference: Python environments in VS Code.
Answered By - Jill Cheng Answer Checked By - Katrina (WPSolving Volunteer)