Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot import tensorflow in vscode

enter image description here I have installed tensorflow in a virtual environment and can import Tensorflow in jupyter notebook or terminal. I am now learning to use VScode, so I try to launch it in the jupyter notebook within the VScode, but Tensorflow cannot be imported.

It shows ModuleNotFoundError: No module named 'tensorflow', but I have installed it and it can be used in the terminal or jupyternotebook.

I also tried to define the path of the python interpreter, but it did not work. Could someone help me out? Tons of thanks.

like image 598
johnwow Avatar asked Jun 27 '26 21:06

johnwow


1 Answers

Try:

This works for me.

pip --version

python -m pip install --upgrade pip

pip3 install tensorflow==2.0.0
like image 190
Harsh gupta Avatar answered Jun 30 '26 10:06

Harsh gupta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!