1#!/usr/bin/env bash 2# Copyright 2017 The TensorFlow Authors. All Rights Reserved. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# ============================================================================== 16 17PYTHON_VERSION=$1 18dpkg --add-architecture armhf 19dpkg --add-architecture arm64 20echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ xenial main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list 21echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ xenial-updates main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list 22echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ xenial-security main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list 23echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ xenial-backports main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list 24sed -i 's#deb http://archive.ubuntu.com/ubuntu/#deb [arch=amd64] http://archive.ubuntu.com/ubuntu/#g' /etc/apt/sources.list 25yes | add-apt-repository ppa:deadsnakes/ppa 26apt-get update 27apt-get install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-dev 28#/usr/local/bin/python3.x is needed to use /install/install_pip_packages_by_version.sh 29ln -sf /usr/bin/python${PYTHON_VERSION} /usr/local/bin/python${PYTHON_VERSION} 30apt-get install -y libpython${PYTHON_VERSION}-dev:armhf 31apt-get install -y libpython${PYTHON_VERSION}-dev:arm64 32 33if [[ "${PYTHON_VERSION}" == "3.8" ]]; then 34 apt-get install -y python${PYTHON_VERSION}-distutils 35fi 36 37/install/install_pip_packages_by_version.sh "/usr/local/bin/pip${PYTHON_VERSION}" 38ln -sf /usr/local/lib/python${PYTHON_VERSION}/dist-packages/numpy/core/include/numpy /usr/include/python${PYTHON_VERSION}/numpy 39