Python basics

tutorial status: new - under construction

Python infrastructure

Python installation

Python Package Index PyPi

Most packages can be found on the Python Package Index; they can thus be installed in the terminal / shell via the Python installer pip . PyPi has a website where you can read up on the functionality of packages as well as their prerequisites and dependencies:

https://pypi.org/

The installation instructions in the next section help you install packages on your own machine. Please read the instructions carefully and to the end before starting an installation.

Python module installation

Python's functionality is routinely expanded and customized by means of modules for specific processing needs, such as for example natural language processing by means of the Natural Language Toolkit (NLTK) or SpaCy. The generic commands look like this:

Windows:

python -m pip install -U SomePackage

py.exe -m pip install -U SomePackage

Commands have to be run from the terminal and with administrator privileges in order to install all packages to a unified location for any user of your machine and not just for the current user. So please make sure you have administrator privileges on your computer.

Examples:

The following command installs the Python module numpy:

python -m pip install -U numpy

Mac OS:

pip3 install -U SomePackage

Note: Mac OS users of Python 3, need to call pip3 in order to install Python3 modules!

Examples:

pip3 install -U numpy

Python installation: servicing your infrastructure

Every once in a while, your installed modules will have to be updated.