Install Machine Learning Tool in Python

In this article i will show you how to install tensorflow in python3. It's quite easy in ubuntu to set the tensorflow which is an open-source machine learning software.

Run the following commands/script to get tensorflow (CPU only) installed on your Ubuntu 16.04 server.

# Install necessary python packages.
sudo apt-get install python3-pip python3-dev -y

# Upgrade pip using this
pip3 install --upgrade pip

# Install tensorflow (cpu only)
pip3 install tensorflow

If you want to use an NVIDIA GPU for tensorflow then run this instead:

# Install necessary python packages.
sudo apt-get install python3-pip python3-dev -y

# Upgrade pip
pip3 install --upgrade pip

# Install tensorflow with GPU support
pip3 install tensorflow-gpu

That seemed a little too easy, so let's just write a small test script that uses the tensorflow library that we have installed it correctly:

#!/usr/bin/python3
import tensorflow as tf
hello = tf.constant("Hello, Tensflow!")
sess = tf.Session()
print(sess.run(hello))

If you execute this output should be :

b'Hello, Tensflow!'

Now you have successfully installed tensorflow in your system. If you want to read more about the tensorflow then follow the link.


No comments:

Post a Comment

Download the eBook of react js for beginners

ReactJS basically is an open-source JavaScript library which is used for building user interfaces specifically for single page applications...

Popular