If you can define the language like Python for you Travis config file, then the following tip is NOT required because Python 3.6 is the default Python when language is python.
However, if the language of yours Travis config is NOT Python, then the trick is to set the Python bin in as global env var. Following an example.
language: go # using xenial dist: xenial # Python 3.6 is the default Python when language: python. # But when not language: python, Python 3 can not be used by default. # There is pip (/usr/bin/pip), but not pip3. # Because of it the global env is required. env: global: - PATH=/opt/python/3.6.7/bin:$PATH # Install python3 and utilities dependencies addons: apt: packages: - "python3" - "python3-pip"