Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ if [[ "$py_major" -ne 3 || "$py_minor" -lt 10 || "$py_minor" -gt 12 ]]; then
fi
echo "[INSTALL] Found Python ${python_version}"

# Check and upgrade pip
if python3 -m pip -V &>/dev/null; then
# Pip Check and Upgrade
python3 -m pip -V
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be replaced with pip_location ?

if [ $? -eq 0 ]; then
echo '[INSTALL] Found pip'
upgrade_cmd="python3 -m pip install --no-cache-dir --upgrade pip"
[[ "$(uname)" != "Darwin" ]] && upgrade_cmd+=" --user"
eval $upgrade_cmd
# check if python is running in venv. The location for venv should be differ from /usr/lib/python3.xx
pip_location=`python3 -m pip -V`
if [[ $unamestr == 'Darwin' || "$pip_location" != "/usr/lib/python"* ]]; then
python3 -m pip install --no-cache-dir --upgrade pip
else
python3 -m pip install --no-cache-dir --upgrade pip --user
fi
else
echo '[ERROR] python3-pip not installed'
exit 1
Expand Down
Loading