python-pyicu Sub-process /usr/bin/dpkg returned an error code

Koda asked:

I can’t remove or update python on debian Stretch

Entfernen von python-pyicu (2.2-1+b1) ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
SyntaxError: invalid syntax
dpkg: Fehler beim Bearbeiten des Paketes python-pyicu (--remove):
 Unterprozess installiertes pre-removal-Skript gab den Fehlerwert 1 zurück
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/", line 24, in <module>
    from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
dpkg: Fehler beim Aufräumen:
Unterprozess installiertes post-installation-Skript gab den Fehlerwert 1 zurück
Fehler traten auf beim Bearbeiten von:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have try:
apt –fix-broken install
apt-get purge python3
apt-get -f install
apt-get update && apt-get dist-upgrade && apt-get autoremove

I get allways the same error. How can i fix it?

EDIT1: Symlink:

lrwxrwxrwx 1 root root          24 Nov 22 13:48 python -> /etc/alternatives/python
lrwxrwxrwx 1 root root           9 Jan 24  2017 python2 -> python2.7
-rwxr-xr-x 1 root root     3779512 Sep 26 20:42 python2.7
lrwxrwxrwx 1 root root          25 Nov 22 15:56 python3 -> /etc/alternatives/python3
-rwxr-xr-x 2 root root     4534616 Okt 21 10:08 python3.6
-rwxr-xr-x 2 root root     4534616 Okt 21 10:08 python3.6m

My answer:

Check your symlink /usr/bin/python. This needs to be pointing to python2.7, not python3.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.