mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 21:33:34 +08:00
setup: Ubuntu setup Python >= 3.11 installation workaround
Signed-off-by: TannerGilbert <gilberttanner.work@gmail.com>
This commit is contained in:
+34
-28
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
## Bash script to setup PX4 development environment on Ubuntu LTS (22.04, 20.04, 18.04).
|
## Bash script to setup PX4 development environment on Ubuntu LTS (24.04, 22.04, 20.04, 18.04).
|
||||||
## Can also be used in docker.
|
## Can also be used in docker.
|
||||||
##
|
##
|
||||||
## Installs:
|
## Installs:
|
||||||
@@ -49,28 +49,17 @@ if [[ ! -f "${DIR}/${REQUIREMENTS_FILE}" ]]; then
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# check ubuntu version
|
# check ubuntu version
|
||||||
# otherwise warn and point to docker?
|
# otherwise warn and point to docker?
|
||||||
UBUNTU_RELEASE="`lsb_release -rs`"
|
UBUNTU_RELEASE="$(lsb_release -rs)"
|
||||||
|
SUPPORTED_UBUNTU_VERSIONS=("18.04" "20.04" "22.04" "24.04")
|
||||||
if [[ "${UBUNTU_RELEASE}" == "14.04" ]]; then
|
if [[ ! " ${SUPPORTED_UBUNTU_VERSIONS[*]} " =~ ${UBUNTU_RELEASE} ]]; then
|
||||||
echo "Ubuntu 14.04 is no longer supported"
|
echo "Unsupported Ubuntu version: ${UBUNTU_RELEASE}"
|
||||||
exit 1
|
exit 1
|
||||||
elif [[ "${UBUNTU_RELEASE}" == "16.04" ]]; then
|
else
|
||||||
echo "Ubuntu 16.04 is no longer supported"
|
echo "Ubuntu ${UBUNTU_RELEASE}"
|
||||||
exit 1
|
|
||||||
elif [[ "${UBUNTU_RELEASE}" == "18.04" ]]; then
|
|
||||||
echo "Ubuntu 18.04"
|
|
||||||
elif [[ "${UBUNTU_RELEASE}" == "20.04" ]]; then
|
|
||||||
echo "Ubuntu 20.04"
|
|
||||||
elif [[ "${UBUNTU_RELEASE}" == "22.04" ]]; then
|
|
||||||
echo "Ubuntu 22.04"
|
|
||||||
elif [[ "${UBUNTU_RELEASE}" == "21.3" ]]; then
|
|
||||||
echo "Linux Mint 21.3"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Installing PX4 general dependencies"
|
echo "Installing PX4 general dependencies"
|
||||||
|
|
||||||
@@ -105,12 +94,17 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends i
|
|||||||
# Python3 dependencies
|
# Python3 dependencies
|
||||||
echo
|
echo
|
||||||
echo "Installing PX4 Python3 dependencies"
|
echo "Installing PX4 Python3 dependencies"
|
||||||
if [ -n "$VIRTUAL_ENV" ]; then
|
PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}')
|
||||||
# virtual environments don't allow --user option
|
REQUIRED_VERSION="3.11"
|
||||||
python -m pip install -r ${DIR}/requirements.txt
|
if [[ "$(printf '%s\n' "$REQUIRED_VERSION" "$PYTHON_VERSION" | sort -V | head -n1)" == "$REQUIRED_VERSION" ]]; then
|
||||||
|
python3 -m pip install --break-system-packages -r ${DIR}/requirements.txt
|
||||||
else
|
else
|
||||||
# older versions of Ubuntu require --user option
|
if [ -n "$VIRTUAL_ENV" ]; then
|
||||||
python3 -m pip install --user -r ${DIR}/requirements.txt
|
# virtual environments don't allow --user option
|
||||||
|
python -m pip install -r ${DIR}/requirements.txt
|
||||||
|
else
|
||||||
|
python3 -m pip install --user -r ${DIR}/requirements.txt
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# NuttX toolchain (arm-none-eabi-gcc)
|
# NuttX toolchain (arm-none-eabi-gcc)
|
||||||
@@ -137,9 +131,6 @@ if [[ $INSTALL_NUTTX == "true" ]]; then
|
|||||||
libisl-dev \
|
libisl-dev \
|
||||||
libmpc-dev \
|
libmpc-dev \
|
||||||
libmpfr-dev \
|
libmpfr-dev \
|
||||||
libncurses5 \
|
|
||||||
libncurses5-dev \
|
|
||||||
libncursesw5-dev \
|
|
||||||
libtool \
|
libtool \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
screen \
|
screen \
|
||||||
@@ -153,7 +144,20 @@ if [[ $INSTALL_NUTTX == "true" ]]; then
|
|||||||
kconfig-frontends \
|
kconfig-frontends \
|
||||||
;
|
;
|
||||||
fi
|
fi
|
||||||
|
if [[ "${UBUNTU_RELEASE}" == "24.04" ]]; then
|
||||||
|
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||||
|
kconfig-frontends \
|
||||||
|
libncurses6 \
|
||||||
|
libncurses-dev \
|
||||||
|
libncursesw6 \
|
||||||
|
;
|
||||||
|
else
|
||||||
|
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||||
|
libncurses5 \
|
||||||
|
libncurses5-dev \
|
||||||
|
libncursesw5-dev \
|
||||||
|
;
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$USER" ]; then
|
if [ -n "$USER" ]; then
|
||||||
# add user to dialout group (serial port access)
|
# add user to dialout group (serial port access)
|
||||||
@@ -209,6 +213,8 @@ if [[ $INSTALL_SIM == "true" ]]; then
|
|||||||
java_version=11
|
java_version=11
|
||||||
elif [[ "${UBUNTU_RELEASE}" == "21.3" ]]; then
|
elif [[ "${UBUNTU_RELEASE}" == "21.3" ]]; then
|
||||||
java_version=11
|
java_version=11
|
||||||
|
elif [[ "${UBUNTU_RELEASE}" == "24.04" ]]; then
|
||||||
|
java_version=11
|
||||||
else
|
else
|
||||||
java_version=14
|
java_version=14
|
||||||
fi
|
fi
|
||||||
@@ -224,7 +230,7 @@ if [[ $INSTALL_SIM == "true" ]]; then
|
|||||||
sudo update-alternatives --set java $(update-alternatives --list java | grep "java-$java_version")
|
sudo update-alternatives --set java $(update-alternatives --list java | grep "java-$java_version")
|
||||||
|
|
||||||
# Gazebo / Gazebo classic installation
|
# Gazebo / Gazebo classic installation
|
||||||
if [[ "${UBUNTU_RELEASE}" == "22.04" ]]; then
|
if [[ "${UBUNTU_RELEASE}" == "22.04" || "${UBUNTU_RELEASE}" == "24.04" ]]; then
|
||||||
echo "Gazebo (Harmonic) will be installed"
|
echo "Gazebo (Harmonic) will be installed"
|
||||||
echo "Earlier versions will be removed"
|
echo "Earlier versions will be removed"
|
||||||
# Add Gazebo binary repository
|
# Add Gazebo binary repository
|
||||||
|
|||||||
Reference in New Issue
Block a user