Introduction au Machine Learning
avec Python
Installing Anaconda Python
For data science, I recommend installing and using the Anaconda distribution of
Python. This section details the installation of the Anaconda distribution of Python on
Windows OS, Linux OS and MacOS. Anaconda is free (although the download is large
which can take time) and can be installed on school or work computers where you
don't have administrator access or the ability to install new programs. Anaconda
comes bundled with about 600 packages pre-installed including Pandas,
NumPy, Matplotlib and Scikit-Learn. These packages are very useful for data
science.
Installing Anaconda Python on Windows OS
Follow the steps below to install the Anaconda distribution of Python on Windows.
Steps:
1. Visit Anaconda.com/downloads
2. Select Windows and Download the .exe installer (Python 3.7 version)
3. Open and run the .exe installer
4. Follow the installation instructions
5. Open the Anaconda Prompt and run some code
Installing Anaconda on MacOS
This section details the installation of the Anaconda Distribution of Python on MacOS.
Most versions of MacOS come pre-installed with legacy Python (Version 2.7). You can
confirm the legacy version of Python is installed on MacOS by opening and running a
command at the MacOS terminal. To open the MacOS terminal
use [command]+[Space Bar] and type terminal in the Spotlight Search bar.
In the MacOS Terminal type (note: the dollar sign $ is used to indicate the terminal
prompt. The dollar sign $ does not need to be typed): $ python. You will most likely
see Python version 2.7 is installed.
Follow the steps below to install the Anaconda distribution of Python on MacOS.
Steps:
1. Visit Anaconda.com/downloads
2. Select MacOS and Download the .dmg installer (Python 3.7 version)
3. Open the .dmg installer
4. Follow the installation instructions
5. Open a terminal and type python and run some code
1 © Bassem BEN HAMED
Introduction au Machine Learning
avec Python
Installing Anaconda on Linux
This section details the installation of the Anaconda distribution of Python on Linux,
specifically Ubuntu 18.04, but the instructions should work for other Debian-based
Linux distributions as well.
Ubuntu 18.04 comes pre-installed with Python (Version 3.6) and legacy Python
(Version 2.7). You can confirm the legacy version of Python is installed by opening
up a terminal.
Steps:
1. Visit Anaconda.com/downloads
2. Select Linux and Download the .sh installer (Python 3.7 version)
3. Verify the Data Integrity of the installer
4. Run the Anaconda Script
5. Selection options
It is recommended that you type yes to use the conda command.
6. Activate installation
7. Open a terminal and type python and run some code
2 © Bassem BEN HAMED
Introduction au Machine Learning
avec Python
Installing Tensorflow with pip
Open your main Terminal (Linux OS or MacOS) or the Anaconda Prompt (Windows
OS) and enter the following three commands (line by line):
pip install theano
pip install tensorflow
pip install keras
You can test
Installing Tensorflow without pip
Tensorflow cannot be installed with Python 3.7 (with pip install), we will install it with
Python 3.6. Fortunately, Anaconda has a feature called "environments" that allows you
to install more than one version of Python in different environments, each with different
packages installed as you see fit. So you can have only one environment for the sole
purpose of these tutorials if you wish, and it will not spoil your default Python
installation. This allows us to keep 3.7 as Python by default, while installing an older
version, too, for use with tensorflow.
Steps:
Open your main Terminal (Linux OS or MacOS) or the Anaconda Prompt (Windows
OS) and enter the following commands (step by step):
1. Create a new environment with Anaconda and Python 3.7
conda create -n tensorflow python=3.7 anaconda
2. Activate the environment
3 © Bassem BEN HAMED
Introduction au Machine Learning
avec Python
activate tensorflow
3. After this you can install Theano, TensorFlow and Keras
conda install theano
conda install tensorflow
conda install keras
4. Update the packages
conda update --all
4 © Bassem BEN HAMED