How to change default python version on Debian 9 Stretch Linux -

Debian 9 Stretch comes with two 2.7 and 3.5 python versions. If you have not installed any python package yet you can choose between both by simply installing an appropriate package:
This is a companion discussion topic for the original entry at

Paweł Tęcza

Very helpful howto, thanks a lot! :slight_smile:


i changed python version selectively on per user basis,
will the LOCAL python default to 2.X if i update the system later on? or will i still be using 3.X

Followed the above guide to downgrade 3.7 to 3.6 and now I get:

:~$ mkvirtualenv test
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 7, in <module>
    from virtualenv import main
  File "/usr/lib/python3/dist-packages/", line 25, in <module>
    import distutils.sysconfig
ModuleNotFoundError: No module named 'distutils.sysconfig'

I have the same python-3.6 and python-3.7 deb packages:

libpython3.6-dev/unstable,now 3.6.8-1 amd64 [installed,automatic]
libpython3.6-minimal/unstable,now 3.6.8-1 amd64 [installed,automatic]
libpython3.6-stdlib/unstable,now 3.6.8-1 amd64 [installed,automatic]
libpython3.6/unstable,now 3.6.8-1 amd64 [installed]
python3.6-dev/unstable,now 3.6.8-1 amd64 [installed]
python3.6-doc/unstable,unstable,now 3.6.8-1 all [installed]
python3.6-minimal/unstable,now 3.6.8-1 amd64 [installed,automatic]
python3.6-venv/unstable,now 3.6.8-1 amd64 [installed]
python3.6/unstable,now 3.6.8-1 amd64 [installed]