Basic Python Tutorial

It is strongly recommended that you first finish this tutorial. I will be using Python version 2.7 , hence for convenience, you are expected to install Python version 2.7 on your sytem. The walkthrough for the installation is platform specific, you should refer to the official Python Website. Once you’re sure that you installed the correct python version on your system CD to correspnding directory for MEE404 class you created by using whichever name you want to use. Here I preferred MEE404 for convenience.

cd MEE404

It is very common to use virtual environments for specific tasks. It helps you to create and work on a virtual environment specifically tailored for one specific task. It includes a python instance and keeps the core installation isolated. This makes it possible to install and try different python packages without compromising the core installation. Running the following command will create a virtual environment hosted in venv directory. It is a common practice to name the directory as venv.

virtualenv --system-site-packages venv

Once you create virtual instance you can work on it by simply running the following command in the terminal.

source venv/bin/activate

In this class we will need pillow library which should be installed separately. You can use pip to install Pillow.

pip install pillow

We will also extensively use matplotlib and numpy. Numpy comes with some installations but to ensure you have both matplotlib and numpy it is convenient to run pip for these libraries as well.

pip install numpy
pip install matplotlib

Jupyter is another common way to interpret with python scripts easily. You can edit, modify and run python scripts within your browser. Contemporary works, especially on machine learning etc., are mostly displayed in jupyter environment. I strongly recommend you to install and play with this environment.

pip install jupyter

See iPython Tutorial for further details. The exercises will be in the exercises folder of this GitHub Repository. The repo will be updated regularly. To follow the updates visit this site occasionally. Assuming that you download the repo, just cd to the exercises directory and there run the following command.

jupyter notebook

Once you run the above command it will start a local server where you can reach, view and run ipynb files easily. Check this iPython Tutorial Page

It is possible to stop virtual environment with the following command


I recommend you to check the documentation pages for the libraries given above. You can start with the following tutorials. It is important for you to understand why and where we do use libraries, i.e. pillow, numpy and matplotlib.