WHAT IS PYTHON AND HOW DO YOU INSTALL PYTHON
(2011-2018)


The official Python website http://www.python.org/

Python version 2 or version 3?
Python 3 if possible. Python 3 is not compatible with Python 2.
See for the differences: Modifications from Python 2 to Python 3

Installation of Python
See http://www.python.org/ for downloading Python version 3.
Python files do have the extension ".PY" or ".PYW". You can modify them by the built in ASCII editor with simple development environment named IDLE. The link to IDLE can be found on the desktop or in the start menu.


Screenshot of the editor IDLE.

The programming language Python
Python is really a nice programming language. Not only for professionals, but also for us, hobbyists. Just take a look on the Python website (http://www.python.org/), Click "about" to read what Python can do. But do not be discouraged by the excess of information you will find. I also do only understand a little of everything you can find there! And Python is free and not too complex, this in contrary to other programming languages. The source code is written in ASCII. So you can modify the source code simply with an ASCII editor like notepad to your own requirements. But it is better to use the built in ASCII editor with simple development environment named IDLE. Click "Help"-->"Documentation" on the taskbar of IDLE to find a lot of documentation. Python codes are saved with the extension .PY or .PYW.
Developing a program goes very fast, you can try out your program very quickly all the time. During trying out your program, it is not necessary to compile it to an EXE file. You can run a program directly from the IDLE editor, click "Run"-->"run Module". You would expect that Python is slow, as the source code is written in ASCII. But that is not the case. Before you run a program, it is compiled within a fraction of a second to a for us not readable but by the PC very fast executable code. However, Python is not as fast as C!

Internal and external modules
With Python, a numerous internal modules are supplied. If you want to make an FTP server, then you have to import the internal FTP module. We only import the internal modules we want to use. That saves a lot of memory!
There are also external modules, made by third parties like for example universities. I do use the external audio module PYAUDIO to read the data from the sound card, and the PIL or PILLOW library to make and edit pictures (BMP and JPG files). Very often, the external modules NUMPY and SCIPY are used for numerical and scientific calculations. I did use the FFT routines of NUMPY in some programs. The NUMPY routine was 4x faster than my own written routine. The disadvantage of external modules is that they cannot always be used with the latest versions of Python. For us, hobbyists, modules for RS232 applications are very interesting of course.


The graphical user interface (buttons, slide bars etc.), made with Tkinter.
This is the simple graphical user interface of the frequency counter program.

Graphical user interface (GUI or all the buttons, slide bars etc.)
Python has an internal module Tkinter, with which you can make a simple graphical user interface (buttons, slide bars etc.). I do use Tkinter for my programs. But there are also external modules like WXpython together with WXcard with which you have much more extensive possibilities to make such a graphical user interface. I do like to keep it simple and do not find that necessary.


With Python installed documentation and tutorial.

How do you learn to program in Python
Click "Help"-->"Documentation" on the taskbar of IDLE to find a lot of documentation. It is very easy to learn Python by studying the together with Python installed documentation and to follow the tutorial and to try out and look at the many example programs on the internet. But in the beginning, Tkinter for the graphical user interface is quite difficult to understand. However, when you have found out once how it works, it is very usable. You can use the frequency counter program on this website as an example and on the internet, you can find various tutorials. And it is also possible to use Python in a console window, just as the old BASIC language DOS. In practice, you will often copy parts of old programs or programs found on the internet, you do not always want to find out twice what the right code is.


Installation of Python for Windows:
I use Python3.6, because there was an error message when I installed pyaudio with Python 3.7: Microsoft Visual C++ is required. The given link did not work anymore. And the version from https://visualstudio.microsoft.com/thank-you-for-downloading-visual-studio/ gave the same error message again.

Go to: https://www.python.org/downloads/windows
Download Windows x86 executable installer and Run it.
IMPORTANT: Select "Add Python 3.6 to PATH"
Then select "Install Now"

Python is installed in c:users/onno1/AppData/Local/Programs/Python/Python36-32

Installation is done with "pip" as follows:
(The message when I used pip the first time: Upgrade pip and I did that as was explained in the same message.)

Open a terminal screen (Menu --> Windows System --> Command Prompt) and type the following commands:

pip install numpy
pip install pillow
pip install pyaudio

You can start a Python program when opened with IDLE by selecting "run module".
Or:
Open the folder with the Python program with the Windows Explorer.
Select in the Windows Explorer --> File --> Open command prompt
And type: python program-name.py


Installation of Python for Linux Mint:
Open the Software Manager:
Python3.6 is already installed, also with the name python3:
Installation of Numpy, pil.imagetk and pyaudio, type the following commands in the Software Manager in the Search window:

"python3 numpy" and install it
"python3 pil.imagetk" and install it (PIL is already installed)
"python3 pyaudio" and install it

Installation of Python's integrated Developement and Learning Environment (Idle), type the following commands in the Software Manager in the Search window:

"python3.6 idle" and install it.

You can find Idle in the Menu --> Programming

You can start a Python program when opened with IDLE by selecting "run module".
Or:
Open the folder with the Python program in a Terminal
And type: python3 program-name.py


Installation of Python for the Raspberry Pi:
(The command "sudo" will give you the required rights to install the software as administrator,
"apt-get install" is the command to download and install the software.)

Python3.6 is already installed:
Installation of Numpy, pil.imagetk and pyaudio, type the following commands in the Software Manager in the Search window:

Open the Terminal window ("Monitor" on the Taskbar). Installation of Numpy, pil.imagetk and pyaudio, type the following commands:

sudo apt-get install python3-numpy (not necessary was already installed)
sudo apt-get install python3-pillow (not necessary was already installed)
sudo apt-get install python3-pil.imagetk (necessary, not installed, but perhaps already with newer versions of pillow!)
sudo apt-get install python3-pyaudio

Installation of pulseaudio and its volume control, type the following commands:

sudo apt-get install pulseaudio
sudo apt-get install pavucontrol

You can find the volume control in the Menu --> Sound & Video. You can also find there the selection of input devices.

You can start a Python program when opened with IDLE by selecting "run module".
Or:
Open the folder with the Python program in a Terminal
And type: python3 program-name.py



BACK TO INDEX PA2OHH