'unable to import anything in jupyter notebook vscode

Im working on a jupyter notebook in VScode and am unable to use any imports. The first cell contains

import tensorflow as tf

and the 2nd cell contains

tf.__version__

and i get the following error.

NameError Traceback (most recent call last) /var/folders/dx/qz5pd1k146x9rm5zh1n434mm0000gn/T/ipykernel_86923/985137052.py in ----> 1 tf.version

NameError: name 'tf' is not defined

Tensorflow shows up on pip list in my current environment (the base anaconda environment) and I'm not sure what I'm doing wrong.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source