Python Tutorial- How To Install Python

Machine Learning & Data science with R

Python is on the way, enroll before prices goes up. Enroll today at 65% discount & start learning machine learning with R.

I have been receiving lot of requests for adding python-based course for machine learning & data science.

But instead of creating a separate course for it, I have decided to upgrade my existing course on machine learning & data science where I have used R programming language.

This will give students a holistic view and better value for money.

Once updated, this course will have all the major machine learning models in R as well as python.

But while I will update the machine learning course with python, it is important to learn python programming also.

Thanks to overwhelming support to my machine learning & data science course with R, initially I wanted to add these videos to my course but due to time constraint, I have decided to add these as posts where I will explain the overview of python programming.

This will save time and this way we can share our knowledge with larger audience who can use python for other purposes also because python fundamentals are not exclusive to machine learning.

This information can be used in other domains also.

These posts will give you enough to start with python programming.

Off course, we are dealing with a programming language therefore there is no end to learning it, but our focus is machine learning with python. So, we will only cover basic overview of python so that you can easily get going with it for machine learning & data science projects.

Alright, so before we start with Python tutorial, we need to install it on your machine and setup the basic python environment so that once i start publishing posts on python tutorial, you should be able to run the code on your machine. 

Install Python

Install Python and Libraries on your machine

In next few posts, we are going to learn one of the most popular high-level language, Python. We will be using Python 3.X for our course and this post.

These posts are geared towards beginners and no experience in Python or any other programming language is required.

This tutorial is small, simple and covers all the basic python concepts to prepare you to get into more complex python programming.

This tutorial intends to take you towards data science/machine learning and will focus on usage of Python in data science field.

Fundamentals of python remains same, but if you are not interested in data science and intend to use python for some other purpose, you can take this knowledge forward by using appropriate course or material for other fields like python for web development etc.

Idea is to create a good foundation in python basics rather than directly jumping into the sea without knowing the swimming. So, you will learn the basics and then you can further research on your own to advance your skills.

But before we start learning python 3, we need to install python on your computer. I will walk you through the process of installing python on your windows machine as most of the Mac OS machines are pre-installed with Python. But you can use same process to install Python 3x or any other version on your machine.

I will provide ability to copy code from the web page so that you can copy paste it in your interpreter. In case of bigger programs, you will get download file.

I will recommend practicing a lot while learning by changing values or trying out different things in the code given on this website.

Install Python 3-Not So Good Way

I will show you a better way to install python so just go through this section for information purpose and do not install python using this method.

But if you are planning to use Python for any purpose and not machine learning, you can install using this method. There is nothing wrong with it.

Visit https://www.python.org/downloads/ and download Python 3.X version. I have mentioned 3.X version because depending upon time, these versions could change but we will focus on Python 3.

it is like installing any other software on your computer, you will have to run .exe which will install the Python 3 on your computer in the C directory.

After installation is done, you will find a Python3X folder in your C drive. if it is not installed in your C drive, check other directories. You can use "search" function in your computer to find it.

Python3X directory/folder will have all the necessary files to run python on your computer. You will find an application file in this folder.

When you run it, it will open the python work-space/console in which you can enter python code to test it.

You can directly enter python code in this console or you can use any free editor to do that.

One of the best free option is "notepad++". Just save the file with the extension "PY" to activate the python editor and it will highlight and color code your data in it.

You can test your python installation, by running the python application file and enter;

it should output= hello python

print("hello python")
python tutorial

For paid and more advance python IDE, you can use Komodo or PyCharm.

Install Python 3- Good Way Jupiter Way

This is one of the easiest ways to download and install everything you need for learning python and data science.

It is called Anaconda distribution.

It contains pretty much everything needed for running python code for data science & machine learning.

 Python need certain libraries for performing scientific computing & data science tasks like numpy, pandas etc. Most of these libraries are part of Anaconda distribution package.

It is extremely good for beginners because you will use a browser-based editor to write and run python code instead of using a typical editor which could be a bit awkward for beginners.

Please note that you are free to use any editor or distribution of your choice but I will be using anaconda distribution.

Anaconda distribution is the package which will install python, jupyter notebook (easy, web-based editor) and commonly used python packages for data science.

I will be using Jupyter Notebook for this book so let’s go ahead and download it.

I will suggest you visit http://jupyter.org/ and learn about jupyter notebook.

Install Jupyter Notebook with Anaconda Distribution

Visit https://www.anaconda.com/distribution/#download-section and download anaconda installation package based on your operating system- windows, macOS or Linus.

Also, if there is memory problem with your computer, you can install miniconda from https://docs.conda.io/en/latest/miniconda.html.

This is a mini version of Anaconda distribution package and will still have lots of libraries but smaller in size. But if size is not problem, you can install anaconda.

This package will install python, libraries and jupyter notebook. To run, jupyter notebook, open command prompt(windows)/terminal (macOS) in your computer and write “Jupyter notebook” and press/click enter.

command prompt to open jupyter notebook
command prompt jupyter notebook

It will open Jupyter notebook in the browser.

You can also open jupyter notebook from your task bar using jupyter notebook icon or using Anaconda navigator.

windows taskbar anaconda menu

Anaconda Navigator

anaconda navigator

As you can see, there are multiple ways of launching jupyter notebook. And once you open using your preferred way, it will launch in your browser.

You need to repeat this step each time you want to launch Jupyter notebook and Control/Command + C to shut down it after using it.

jupyter notebook

Now we will use it to run and learn python using jupyter notebook for data science.

Step 1- Please note by default jupyter notebook will be pointing to your C drive and will display all your system's folders like Desktop, Documents etc. We will first need to navigate to desired folder.

I will create a folder "Python Scripts" in my Document folder. I will suggest you do the same with desired name of folder (same or different) and in desired location.

Then navigate to this folder. So i will first click on Documents in the above screen shot followed by Python scrip folder.

Create a new notebook in jupyter notebook using the screen shot. You will click on “New” and then select Python 3 from the drop down.

And if you are thinking what is "mlenv", this is a kernel for my virtual environment. We will learn it in my machine learning course, you can ignore it for now because here we are focusing on learning fundamentals of python and not machine learning. 

create notebook in jupyter notebook

If you are not using anaconda distribution or jupyter notebook, please make sure python & an appropriate python editor is installed on your computer.

Because from here on, we will start working on python and you will need these to practice along.

Please share it with your friends, family & colleagues who are interested in learning Python or machine learning.

And as i have mentioned earlier, i am going to update my machine learning course with Python based machine learning videos. So don't forget to subscribe to get the notification as soon as it is updated. 

About akhilendra

Hi, I’m Akhilendra and I write about Product management, Business Analysis, Data Science, IT & Web. Join me on Twitter, Facebook & Linkedin

Speak Your Mind

*