Home Python Introduction to Python Python Tutorials – Episode 2 – Setting up Machine

Python Tutorials – Episode 2 – Setting up Machine

0

Welcome to Episode 2 of Python Beginner Tutorials.

In Episode 1 of Season 1 of Python Tutorials, we covered some basic background of Python. 

Now that we have established the boring part of Python, lets dive into the real thing. How are we going to approach this programming language? Well, my plan is to first teach you simple concepts of programming which are common in most programming languages like arithmetic, strings, loops, functions and classes in next 5 to 10 episodes. Then, I will go in to depth of language giving detailed use cases of each function in it. And thus, finishing the season 1.

We are going to use Python 3.7 in all seasons of Python Tutorials Series so that people from future can also relate to it.

Setting Up Environment

I will be using windows Environment but you can use any environment you want. The reason for this decision is simply that my Ubuntu machine is extremely slow and I cannot afford to reinstall at this moment. So lets start setting up the environment

Windows Environment

I am using windows 10 64-bit. I hope that most of you are also using Windows 10 64-bit. But if you are not, this environment setting will also work for you with some small tweaks.

First we need to Download Python 3.7, click here to start downloading. Install the downloaded file.

Now comes the hard part for most new pythoneers. Before you start running python, you need to setup the Path Variable of Python in System. To that, follow this tutorial from Python.org

If you find any problem configuring environment variable, comment below and I will guide you myself.

Ubuntu 18.04 Environment

Currently there is no trusted PPA containing python 3.7, so you will have to build it yourself. Download desired version and follow the instruction on this documentation page.

Or

Follow this:

# update system
sudo apt update && sudo apt upgrade -y

# install build tools and python prerequisites
sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev

# download and extract python
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
tar xf Python-3.7.0.tar.xz
cd Python-3.7.0

# build python
./configure --enable-optimizations
# 'make -j <x>' enables parallel execution of <x> make recipes simultaneously
sudo make -j 8
# altinstall does not alter original system python install
sudo make altinstall

# run python3.7 when you type python3
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.7 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
# run below and select python3.7 from the list
sudo update-alternatives --config python3

# or create a shortcut
sudo ln -s /usr/local/bin/python3.7 /usr/bin/py

This bash code is self explanatory and it is so far the best known way at the time of creating this episode to install python 3.7 on Ubuntu 18.04

Mac OS Environment

As I have never had experience with Mac OS, I cannot say which guide to follow but I would recommend checking out the official guide in this link from Python.org

With the hope that you were successful in setting up your environment, lets dive into Python and be a Pythoneer.

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version