The installer file for installing Python 3 can easily be downloaded from the official website (https://www.python.org/downloads/) for Windows, Linux, and Mac 32-bit or 64-bit systems. The installer can be installed by double-clicking on it. This installer also has an IDE named "IDLE" that can be used for development. We will dive deeper into each of the operating systems in the next few sections.
Python installation and setup on Windows
This book is based on the latest Python 3 version. All the code that will be used in this book is written in Python 3, so we need to install Python 3 before we can start coding. Python is an open source, distributed, and freely available language. It is also licensed for commercial use. There are many implementations of Python, including commercial implementations and distributions. In this book, we will focus on the standard Python implementation, which is guaranteed to be compatible with NumPy.
You need to have Python 3.5.x or above installed on your system. The sunset date for Python 2.7 was moved from 2015 to 2020, but at the time of writing, Python 2.7 will not be supported and maintained by the Python community.
At the time of writing this book, we had Python 3.8.3 installed as a prerequisite on our Windows 10 virtual machine: https://www.python.org/ftp/python/3.8.3/python-3.8.3.exe.
Python installation and setup on Linux
Installing Python on Linux is significantly easier compared to the other OSes. To install the foundational libraries, run the following command-line instruction:
$ pip3 install numpy scipy pandas matplotlib jupyter notebook
It may be essential to run the sudo command before the preceding command if you don't have sufficient rights on the machine that you are using.
Python installation and setup on Mac OS X with a GUI installer
Python can be installed via the installation file from the Python official website. The installer file can be downloaded from its official web page (https://www.python.org/downloads/mac-osx/) for macOS. This installer also has an IDE named "IDLE" that can be used for development.
Python installation and setup on Mac OS X with brew
For Mac systems, you can use the Homebrew package manager to install Python. It will make it easier to install the required applications for developers, researchers, and scientists. The brew install command is used to install another application, such as installing python3 or any other Python package, such as NLTK or SpaCy.
To install the most recent version of Python, you need to execute the following command in a Terminal:
$ brew install python3
After installation, you can confirm the version of Python you've installed by running the following command:
$ python3 --version
Python 3.7.4
You can also open the Python Shell from the command line by running the following command:
$ python3
Now that we know how to install Python on our system, let's dive into the actual tools that we will need to start data analysis.