Print PyTorch Version

Find out which version of PyTorch is installed in your system by printing the PyTorch version

Find out which version of PyTorch is installed in your system by printing the PyTorch version

Video Transcript


This video will show you how to find out which version of PyTorch is installed in your system by printing the PyTorch version.


First, we assume that you have already installed PyTorch into your system.

If you have installed PyTorch correctly, then you will be able to import the package while in a Python interpreter session so you can do the PyTorch import.


So import torch.

import tensorflow as tf


Let's import a fake module to show you what error you would get if it wasn't installed.

import superfakeunicorn

So we import superfakeunicorn, and we see ModuleNotFoundError: No module named 'superfakeunicorn'.


So now that we know we have PyTorch installed correctly, let's figure out which version of PyTorch is installed in our system.

print(tf.__version__)

So we do torch.__version__, and we print that.

We see that we have PyTorch 0.4.1.


Perfect! We were able to find out which version of PyTorch is installed in our system by printing the PyTorch version.

Receive the Data Science Weekly Newsletter every Thursday

Easy to unsubscribe at any time. Your e-mail address is safe.