setup: fix installing in virtual env on Ubuntu

This fixes running the Ubuntu setup script in a Python virtual
environment. This was failing because pip doesn't allow the --user
option in virtual environments.
This commit is contained in:
David Lechner 2021-10-13 14:22:49 -05:00 committed by Daniel Agar
parent 351f679c2f
commit 426efb515f
1 changed files with 7 additions and 1 deletions

View File

@ -108,7 +108,13 @@ fi
# Python3 dependencies
echo
echo "Installing PX4 Python3 dependencies"
python3 -m pip install --user -r ${DIR}/requirements.txt
if [ -n "$VIRTUAL_ENV" ]; then
# virtual envrionments don't allow --user option
python -m pip install -r ${DIR}/requirements.txt
else
# older versions of Ubuntu require --user option
python3 -m pip install --user -r ${DIR}/requirements.txt
fi
# NuttX toolchain (arm-none-eabi-gcc)
if [[ $INSTALL_NUTTX == "true" ]]; then