-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_python.zsh
More file actions
executable file
·37 lines (29 loc) · 1 KB
/
setup_python.zsh
File metadata and controls
executable file
·37 lines (29 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env zsh
echo "\n<<< Starting Python Setup >>>\n"
# Python versions are manages with `pyenv`, which is in the Brewfile
# See zshrc for N_PREFIX variables and addition to PATH
# Install Python
echo "Installing Python and Python3 with pyenv..."
# Latest version of Python 2
latest2=$(pyenv install --list | grep " 2." | sed 's/^ //' | grep '^\d' | grep --invert-match 'dev\|a\|b' | tail -1)
# Latest version of Python 3
latest3=$(pyenv install --list | sed 's/^ //' | grep '^\d' | grep --invert-match 'dev\|a\|b' | tail -1)
# Install python 2
if pyenv versions | grep $latest2 1>/dev/null; then
echo "Python $latest2 already installed."
else
echo "Installing Python $latest2"
pyenv install $latest2
fi
# Install python 3
if pyenv versions | grep $latest3 1>/dev/null; then
echo "yo"
echo "Python $latest3 already installed."
else
echo "hey"
echo "Installing Python $latest3"
pyenv install $latest3
fi
echo "Setting python3 as default python"
pyenv global $latest3
pyenv versions