Python Ecosystem – Part 1: Python Installation
0 / 113
Python is an object-oriented programming language that is becoming more and more popular among data scientists and may become the dominant platform for machine learning. It is easy to use, a beginner-friendly language with a simple, clear, and concise syntax that is powerful enough to create robust software for nearly any application.
It is an open-source programming language so you can download it freely and begin developing programs. It is a multi-purpose programming language that equips the features of C and Java which means it has elegant ‘C’ code along with the classes and objects like Java.
According to the studies and surveys, python is the 5th most crucial as well as a popular language for machine learning and data science because of the above reasons. Although it’s a popular and powerful language, it has its own weakness.
It has a slow execution speed. Python is an interpreted language which means its code is first converted into bytecode and then executed by a virtual machine leading to slow execution compared to compiled languages.
Python Installation –
I guess; it’s sufficient for an introduction, let’s begin the execution of python programming. For creating an ML program using python, you first need to install the ecosystem on your computer.
You can install Python in two of the following ways –
1. Individual Installation –
Following is the installation process of Python on the multiple platforms –
Python Installation on Linux and Unix –
If you are using Linux OS, you probably don’t need to worry about Python installation because Linux distributions have already installed Python.
You can check the installed Python version by typing the following command in Terminal –
This command will return the installed Python version. However, if your PC doesn’t have Python installed on it, you can easily compile the latest version of Python from the source.
Run the following steps to install the Python 3.10 on Linux systems:
- 1. Download Python 3.10 source archive from its official site https://www.python.org/downloads/ or run the below command on terminal
$ wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz
- 2. Once the download is complete extract the files by using the command –
- 3. Change to the extracted directory with the cd command, then prepare source code for compilation
$ cd Python-3.10.2
$ ./configure –enable-optimizations
- 4. Run the following command to complete the installation
$ make altinstall
- 5. Now to check the Python version by executing:
$ Python –version
This will return the version of python that you have installed right now.
- 6. Now install pip for Python 3.10
$ pip3.10 -V
pip 21.2.3 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)
Bingo!! You have successfully installed the Python 3.10 on your Linux system and now you can begin developing python programs.
Python Installation on Mac OS –
Mac OS has traditionally with a version of Python 2.7 installed, you don’t need to install or configure anything else to use Python 2. This version is great for learning but not for development as it is outdated.
If your Mac OS doesn’t have Python installed or is outdated, follow the below steps to install it –
- 1. Install Homebrew. Homebrew is an easy-to-use package installer used to install Python 3. To install Homebrew, run the following command –
$ /bin/bash -c “$(curl –fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”
- 2. Once you’ve installed Homebrew, insert the Homebrew directory at the top of your PATH environment variable by adding the following line at the bottom of your ~/.profile file
If you are using OS X 10.12 (Sierra) or older use the below line instead
- 3. Now, you can install Python 3, for installation run the following command
$ brew install python3
Python Installation on Windows –
Python installation on Windows is the easiest among the other platforms. It will take just a few clicks and your system is Python-ready.
- 1. Go to Python’s official website and Download Python x.y.z, where x.y.z is the version of Python you wish to install.
- 2. Now double click the downloaded file, it will take us to the installation wizard. Now accept the default settings until the installation is finished.
2. Using Pre-packaged Python distribution – Anaconda
Anaconda is a packaged compilation of Python which consists of all the widely used in Data Science. Below are the steps you can follow to set up a Python environment using Anaconda –
- 1. Download the installation package from Anaconda distribution for your OS.
- 2. Select the Python version you want to install.
- 3. After selecting the OS and Python version, it will download the Anaconda installer on your computer. Double click the downloaded file and the installer will install the Anaconda package.
- 4. After installation is completed, you are all set to start coding machine learning programs with Python.