Skip to content

Commit aea6001

Browse files
committed
Add pyenv install script and config
1 parent c368258 commit aea6001

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

.bashrc

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ fi
3333
# Fix SSH auth socket location so agent forwarding works with tmux and VS Code
3434
export SSH_AUTH_SOCK=$HOME/.ssh/auth_sock
3535

36+
[ `which pyenv` ] && eval "$(pyenv init -)"
37+
[ `which pyenv` ] && eval "$(pyenv virtualenv-init -)"
38+
3639
[ `which rbenv` ] && eval "$(rbenv init -)"
3740

3841
[ `which colorls` ] && source $(dirname $(gem which colorls))/tab_complete.sh

bash/paths

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
[ -d $HOME/.npm-packages/bin ] && PATH="$HOME/.npm-packages/bin:$PATH"
99
export NODE_PATH=$NODE_PATH:$HOME/.npm-packages/lib/node_modules
1010

11+
# pyenv path
12+
[ -d $HOME/.pyenv/bin ] && PATH="$HOME/.pyenv/bin:$PATH"
13+
1114
# rbenv path
1215
[ -d $HOME/.rbenv/bin ] && PATH="$HOME/.rbenv/bin:$PATH"
1316

install.sh

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ case `uname` in
1212
;;
1313
esac
1414

15+
./install/python.sh
1516
[ `which pip3` ] && sudo pip3 install -r pip/requirements.txt
1617
[ `which pip3` ] && pip3 install --user -r pip/requirements-user.txt
1718
./install/ruby.sh

install/python.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# install pyenv
4+
if [ `which pyenv` ]; then
5+
pyenv update
6+
else
7+
curl https://pyenv.run | bash
8+
. ~/.bashrc
9+
fi
10+
11+
# Install latest (stable) Python
12+
python2_latest=$(pyenv install -l 2>/dev/null | awk '$1 ~ /^2[0-9.]*$/ {latest=$1} END {print latest}')
13+
python_latest=$(pyenv install -l 2>/dev/null | awk '$1 ~ /^[0-9.]*$/ {latest=$1} END {print latest}')
14+
if [ $python2_latest != `pyenv version | awk '{print $1;}'` ]; then
15+
if [ `uname` = 'Linux' ]; then
16+
sudo apt-get install -y libssl-dev
17+
fi
18+
19+
pyenv install --skip-existing $python2_latest
20+
pyenv install --skip-existing $python_latest
21+
pyenv rehash
22+
pyenv global $python2_latest
23+
fi

0 commit comments

Comments
 (0)