Python Setup For Machine Learning
Python Setup For Machine Learning
The first task is to upgrade the system for that the following steps need to be done:
1. Update the repositories
sudo apt update
2. Upgrade the system
sudo apt upgrade
3. Remove outdated programs
sudo apt autoremove
Python 2.7 and 3 comes preinstalled in Ubuntu but we need to install their development
packages. For that run the following commands
For python 2.7
sudo apt install python-dev
For python 3
sudo apt install python3-dev
Using pip the above-mentioned packages can be easily installed. For python 2.7 use the
following command
sudo -H pip2 install <package name>
For python 3 use the command
sudo -H pip3 install <package name>
For some packages we need to specify the version number as well for that we can use
sudo -H pip3 install <package name>==<version>
For eg:
sudo -H pip2 install keras
sudo -H pip2 install keras==2.0.0
For Windows
We will be using anaconda for installing the packages in windows.
The steps to installing anaconda are:
1. Download anaconda for python version 3.7 for 64-bit machine using this link:
https://repo.continuum.io/archive/Anaconda3-2018.12-Linux-x86_64.sh
2. Double click the downloaded file to launch the anaconda. You can follow these
instructions in some trouble or doubt during installation:
https://docs.anaconda.com/anaconda/install/windows/
3. After complete installation of anaconda. Search for "Anaconda Prompt" from the context
menu. Click on it to run.
For installing pytorch first we need to activate the environment using the command in step 2.
Then install pytorch using the following command
conda install pytorch=0.4.1 -c pytorch