Let’s look at the different ways that we can check tensorflow version by using CMD (Command Prompt) and Anaconda Prompt.
Tensorflow installation and uninstallation can be a very difficult task to do as a machine learning newbie. But let’s assume that you have successfully installed tensorflow on your computer. Now, you just want to find which version it is. You might be planning to downgrade or upgrade the version just to suit what you are trying to achieve with tensorflow.
Tensorflow version in CMD
If your system is running windows then you can check your version using both CMD and Anaconda prompt. Let’s look at how you can do it within your CMD.
pip show tensorflow command
If you have installed tensorflow using pip then you can easily get the version by running
pip show tensorflow within your command prompt. But why am I getting a “WARNING: Packages (s) not found: tensorflow“??
It’s because I have installed tensorflow in a python virtual environment. You have to activate your virtual environment if you have done the same thing.
I have created a virtual environment called “tensorflow” using conda, so I’m typing
conda activate tensorflow to activate that environment.
Now let’s try the
pip show tensorflow command again.
As you can see I have the latest tensorflow 2.5.0 version installed on my computer. If you read carefully you can see that the command retrieves more information than just tensorflow version. You can locate where you installed tensorflow in your computer, the author of the package and the license, etc.
Tensorflow version in Anaconda Prompt
If you are running Linux you can easily get the version within the Anaconda Prompt. You can do the same within Windows as well since when you install Anaconda regardless of the operating system it automatically installs Anaconda Prompt in your system.
activate tensorflow (whatever your python virtual environment name is..) before getting a package not found error again.
pip show tensorflow command within Anaconda Prompt.
As you can see, we can get the same set of information for tensorflow that we previously had in Command Prompt.
pip show tensorflow is the simplest command that you can use to check tensorflow version which has been installed on your computer. I highly suggest reading more about tensorflow on the official site linked below.