Reputation: 155
I am very new to this virtual environment concept. So if you could also explain that, it would be great.
Anyways, I am using Anaconda3. Here are the steps that I took to try to use TensorFlow.
(base) C:\Users\ikim1>conda create -n tf tensorflow
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done
FYI, the Environment -> base tab on Anaconda3 did not show TensorFlow - seems like some people were lucky that their Anaconda3 just came with TensowFlow Module...
After the install, I ran this code
conda activate tf
to activate the environment.
import tensorflow as tf
which gives me this error : ModuleNotFoundError: No module named 'tensorflow'
Thus my question is do I need to change directory so that Python knows where it needs to import the module from? So do I need to write a code like below in Spyder?
cd "my virtual environment" (not sure what the code would be)
import tensorflow as tf
Or did I just make some mistake installing it?
Upvotes: 0
Views: 115
Reputation:
Please run the following command to see if Tensorflow is installed. It will either state that the package is not installed or display a bunch of information about it.
pip show tensorflow
If the Tensorflow package is not already installed, please try installing it in the environment where you are working with the following commands before attempting to import tensorflow.
# activate the environment
conda activate tf
# install tensorflow
pip install tensorflow
Upvotes: 0