[CI] – How to make Travis use python3?

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"
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s