• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install TensorFlow on CentOS 8

Written by Admin, Updated On July 20, 2020
centos, python
How to Install TensorFlow on CentOS 8

TensorFlow is an open-source and free software library for machine learning developed by Google. It can be installed system-wide, in a Python virtual environment, as a Docker container, or with Anaconda. Also, large companies like Airbus, Intel, Twitter, PayPal, and Lenovo using TensorFlow. In this tutorial we will show you how to install TensorFlow in a Python virtual environment on CentOS 8.

Install TensorFlow on CentOS#

Perform the following steps to install TensorFlow on CentOS:

Step 1 – Installing Python 3 and venv#

By default Python is not installed on CentOS 8 system. Run the following command to install Python 3 on CentOS 8 machine:

sudo dnf install python3

It will install Python 3 and pip. To run Python 3, you need to type python3 explicitly, and to run pip type pip3.

The recommended way to create a virtual environment is to use the venv module.

Step 2 – Creating Virtual Environment#

First, you have to navigate to the directory where you would like to store your Python 3 virtual environments. Make sure the user has read and write permissions of that directory.

Create a new directory for the TensorFlow project and cd into it:

mkdir tensorflow_demo
cd tensorflow_demo

To create the virtual environment, run the following command:

python3 -m venv venv

The above command will create a directory named venv and it contains a clone of the Python binary, the standard Python library, and other supporting files, the Pip package manager.

To activate it run the activate script:

source venv/bin/activate

Once activated, the virtual environment’s bin directory will be added at the beginning of the system $PATH variable . Also, the shell’s prompt will change, and it will show the name of the virtual environment you’re currently in. In this example, that is (venv).

The pip version 19 or higher is required for TensorFlow installation. To upgrade pip to the latest version run the following command:

pip install --upgrade pip

Step 3 – Installing TensorFlow#

Now at this stage, the virtual environment is activate and we can install the TensorFlow package.

pip install --upgrade tensorflow

That’s it! TensorFlow installation is complete successfully and you can start using it.

Verify the installation by typing:

python -c 'import tensorflow as tf; print(tf.__version__)'

It should show the latest stable version of TensorFlow, at the time of writing this article the latest version is 2.2.0:

2.2.0

Conclusion#

You have successfully learned how to install TensorFlow inside a virtual environment on CentOS 8. To know more about TensorFlow, visit the Get Started with TensorFlow page.

If you have any problem or feedback, please leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install Steam on Ubuntu 20.04
Next Article   How to Extract (Unzip) Tar Bz2 File

Related Posts

  • How to Install Python on Ubuntu 22.04

    How to Install Python on Ubuntu 22.04

    February 18, 2023
  • How to Install Python 3.11 on Debian 11

    How to Install Python on Debian 11

    January 25, 2023
  • How to Install Php 8 on CentOS 8

    How to Install PHP 8 on CentOS 8

    January 27, 2021

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 22.04
    How to Install Microsoft Edge Browser on Ubuntu 22.04 March 14, 2023
  • How to Install Ruby on Ubuntu 22.04 LTS
    How to Install Ruby on Ubuntu 22.04 LTS February 27, 2023
  • How to Install LEMP Stack on Ubuntu 22.04
    How to Install LEMP Stack on Ubuntu 22.04 March 18, 2023
  • How to Install Set Up Apache Virtual Hosts on Ubuntu 22.04
    How to Set Up Apache Virtual Hosts on Ubuntu 22.04 March 2, 2023
  • How to Install MariaDB on Debian 11 Bullseye
    How to Install MariaDB on Debian 11 Bullseye March 8, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook