I am using notebook in VScode and I am working with tensorflow==1.15.5 but in my system version is 2.3.2.
So I created virtual environment with python 3.7 and on system activated python is 3.8 and installed version 1.15.5. Now I want to activate this virtual env in notebook too.
I tried selecting the interpreter (Ctrl + Shift + P) and selected the created environment. But this is not working.
I tried
import tensorflow as tf
print(tf.__version__)
this is still showing 2.3.2
and even
!python --version
is showing 3.8.0
even i tried this article but this is not working too. I am not using conda, any help on this
Make sure your virtual environment is activated and selected as python interpreter in VS Code, and don't forget to select it for Jupyter.
Select and activate an environment
I create a virtual environment called venv and install tensorflow2.5.0. When i select venv as interpreter for .py file and .ipynb file, it will exactly show the same verison of tesorflow installed in new created venv:

[UPDATE]
In Jupyter Notebooks in VS Code, it says
To work with Jupyter notebooks, you must activate an Anaconda environment in VS Code, or another Python environment in which you've installed the Jupyter package.
That's why you install conda and it worked, and even though you select venv but no jupyter package in it, it wouldn't be used when running code cells.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With