Compiling a Package in Pisi Linux / Linux Part 3 Python

Hello to all

Today we will install a python package in our System, but how should we do that?

I will give you a little look how you can install a package what is write in the Python language.

But before we start a bit Basic knowledge about Python, you found at the end of this Introducing any links with Tutorials how you can work with Python or writing your own Python scripts.

Python is an interpreted, object-oriented, higher-level programming language with dynamic typing and binding.

The Python code is directly executable, assuming an installed Python version, that is, You do not have to compile it manually. In the background, the code is first translated into a platform-independent bytecode, which is then executed by an interpreter. This is invisible to the user in the background.

Since the beginning of its development Python follows two basic principles:

  1. Simplicity: The syntax of Python is simple and comprehensible, so that even beginners can find their way around quickly. In order to increase clarity, the structuring of instruction blocks is not carried out; Or braces, but by indentation.
  2. Freedom: object orientation is fully supported in Python, but no object-oriented programming is enforced. Python also supports various programming styles, such as imperative, structural, functional, or aspect-oriented programming. In addition to the built-in functions and types, Python has an extensive standard library with packages for various problems. They range from XML and HTML processing to functions that help solve scientific problems. This often results in a considerable time saving when creating a source code.

Python is in Pisi Linux and the most Linux Distributions installed  by default.

Since a while the most Linux versions works with Python 2 and Python 3, the Server version from Ubuntu 16.04 has only installed the Python 3 version.

An Parallel installation of Python 2 and 3 is easy and conflict-free.

You can check your Python version installation from your System very simple, open a Terminal and give in:

python3 -V  ( for python 3 version )


python -V   ( for python 2 version )

For me in Pisi Linux looks it so



Python 3, which is available since early 2009, is the Python version, which should be preferred. Python 2.7, the last release of the Python 2-branch, was released in mid-2010, is still up-to-date and still receives support (in the form of error corrections, etc.) by 2020. However, innovation and improvements are no longer introduced. These flow exclusively in Python 3.x.

The only reasons why Python 2.7 is still being used are:

  • If a Python program is only available as a version for Python 2.7
  • If a required Python library is not yet ported to Python3 – but this is very rare nowadays.

Since the Python version 2.5, the command line program 2to3 is included in the standard installation of Python 2. With its help, Python-2 programs can easily be tested for their Python-3-suitability or, if desired, converted automatically.

The use is quite simple. In the simplest case, the program is called only with the name of a python script as a parameter:


And receives as output proposals what needs to be changed, such as:

RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored
--- (original)
+++ (refactored)
@@ -3,7 +3,7 @@
 from bottle import route, static_file, template, run, debug
-print 'Starte Programm...'
+print('Starte Programm...')
 def test():

This example suggests that you should replace the print statement from Python 2 with the print function from Python 3. If you call 2to3 with the option -w, you make the changes directly in the file, the old file is created with the extension .bak as a backup.

If you want to start a program written in Python 3, enter the following command:


The installed version of Python 3 is automatically selected

If the program is to be executed with Python 2.7, the command is:


If the Python program contains a Shebang like “#! / usr / bin / env python” or “#! / usr / bin / env python3” and the program is declared as executable. Make a Double-click in the file manager on it:

To create programs with Python, there are three ways, which will i briefly be discussed below.

  1. The interactive Python console – the code is executed immediately upon input
  2. Editors and command line – the code is created in an editor and executed via the command line
  3. Development environments – all components to create a program are grouped into one environment

The interactive console

The operation of the console is similar to the shell for Linux. It is particularly useful for testing smaller sections of the source code because the commands you enter are executed immediately. For beginners, there is a particularly user-friendly (or easy to access) variant called bpython.


The interactive console is started by the following command:


Or for Python 2.7 with:


First, a short message about the Python version appears, then the interactive prompt >>>, where you can now enter commands:



The standard way to create Python programs is via an editor. Some editors provide useful tools such as syntax pre-emphasis or automatic indentation. Example: The source text is created in the preferred editor and saved as ~ / in the home directory:

#!/usr/bin/env python3
# Comment: My Hello-World-Program for Python 3
print('Hello World!')

For Python 2.7, the program looks only slightly different:

#!/usr/bin/env python
# Comment: My Hello-World-Program for Python 2
print 'Hello World!'

Now you can start the program as described above.

Useful commands

To work in the console, there are some very helpful commands from Python. They are explained by a brief example.

A list of all variables known to the console is output:

>>> dir()

The module os is imported. This gives you many ways to get information about the system. With help (os), a commented overview of all classes and methods contained in the module is output:

>>> import os
>>> help(os)


You can customize the interactive console by using a file that is executed at each interactive startup (similar to bashrc the bash file). To do this, the environment variable PYTHONSTARTUP must be set to the desired filename in the shell (here ~ / .pythonrc in the home directory):

export PYTHONSTARTUP=~/.pythonrc

To avoid having to export the export command manually in every newly opened console, it is best to enter it at the end of the bashrc file. Now you only have to create the file ~ / .pythonrc with an editor and enter the desired Python commands. For example, one could import often required modules:

import os
import sys



It is very convenient to use the autocomplete code in the interactive console. For this purpose, e.g. Also used in the bash, readline. However, in the interactive Python console, tab ⇆ is normally used for indentation with the tab character. For automatic completion, press Esc followed by Tab ⇆(strictly speaking: Meta-tab).

However, you can also use a different key or key combination for code completion. To do this, edit the file specified in the PYTHONSTARTUP environment variable with an editor and insert the following:

    import readline
except ImportError:
    print("Module readline not available.")
    import rlcompleter
    readline.parse_and_bind("KEY: complete")  # KEY replace

Instead of the BUTTON, you must specify the desired key or key combination, for example C-o or Ctrl + O for a normally unused key combination. If you specify tab ⇆ for tab,, Ctrl + I still remains for the real tab character. More information can be found in the man page of readline.

So now enough about it, when you need a dependency from Python you can install it with pip. pip is The PyPA recommended tool for installing Python packages.

As example you will install in Pisi Linux ReText, ReText is a simple but powerful editor for Markdown and reStructuredText markup languages. ReText is written in Python language and works on Linux and other POSIX-compatible platforms.

For the work with ReText,  it requires the following Dependencies to run.

  • python3
  • python-qt5
  • python-markups
  • python-markdown — for Markdown language support
  • python-docutils — for reStructuredText language support
  • python-enchant — for spell checking support

In Pisi Linux 2.0 you can install the following Dependencies:

 sudo pisi it python3 python-qt5 python3-qt5 python3-setuptools python-setuptools python-MarkupSafe docutils


Note: In Pisi Linux you have for any packages other names, such as here instead python-docutils only the name docutils.

The packages python-markdown and python-enchant are not at the Moment in the Pisi Linux 2.0 Repo but it comes.

For this install now pip in Pisi Linux

Also type:

 sudo pisi it pip pip3  

After this can you go on work and install the missing python-packages with pip and  the command:

sudo python3 -m pip install pyenchant  


after it type:

 sudo python3 -m pip install Markdown  

So now have you all Dependencies for the  ReText package, ReText is at the moment not available for Pisi Linux 2.0 so you can install it simple with the command

 sudo python3 -m pip install ReText  


it download ReText directly from the Python page.

if you have install it and you will upgrade any Python packages while in the Pisi Linux is not the newest version from it type simple:

 sudo python3 -m pip install --upgrade PackageName  

Note: Replace the word PackageName for the package what you will upgrade.

So after it you have a working ReText-editor for your working.


And when you have a other Python package type simple and easy

sudo python3 install


sudo python install

You see the work with Python is not so hard for more Informations about Python visit the following Links here:

Python 2 Tutorial

Python3 Tutorial

Official Python Tutorial

Easy-to-use Python tutorial

Learn Python-The Hard Way -Despite the name a very good tutorial for beginners who want to learn Python

The Python Guru- friendly introduction

Think Python – How to Think Like a Computer Scientist 2nd Edition for Python3 – as .pdf

Think Python – How to Think Like a Computer Scientist 2nd Edition for Python 2 – as .pdf

Pythonspot – A lot of Python Tutorials

Python FAQ – Frequently asked questions and answers

Development environments for Python (IDE)

SPE IDE – Stani’s Python Editor


That was all about Python what i will write here

Happy coding to you with Python, and many thanks for reading666