Created
August 9, 2019 13:19
-
-
Save simonkuang/14abf618f631ba3f0c7fee7b4ea3f214 to your computer and use it in GitHub Desktop.
Install pyenv in CentOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
yum install -y epel-release | |
yum install -y gcc gcc-c++ glibc glibc-devel curl git \ | |
libffi-devel sqlite-devel bzip2-devel bzip2 readline-devel | |
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | /bin/bash | |
cat <<EOF >> $HOME/.bashrc | |
# Load pyenv automatically by adding | |
# the following to ~/.bash_profile: | |
export PATH="/root/.pyenv/bin:\$PATH" | |
eval "\$(pyenv init -)" | |
eval "\$(pyenv virtualenv-init -)" | |
EOF | |
export PATH="$HOME/.pyenv/bin:$PATH" | |
eval "$(pyenv init -)" | |
eval "$(pyenv virtualenv-init -)" | |
mkdir -p $HOME/.pyenv/cache | |
# Python 3 | |
PYVER=3.7.4 | |
curl -Lo "$HOME/.pyenv/cache/Python-$PYVER.tar.xz" \ | |
"https://npm.taobao.org/mirrors/python/$PYVER/Python-$PYVER.tar.xz" | |
env CFLAGS=-fPIC pyenv install $PYVER | |
# Python 2 | |
PYVER=2.7.16 | |
curl -Lo "$HOME/.pyenv/cache/Python-$PYVER.tar.xz" \ | |
"https://npm.taobao.org/mirrors/python/$PYVER/Python-$PYVER.tar.xz" | |
env CFLAGS=-fPIC pyenv install $PYVER | |
mkdir -p $HOME/.config/pip | |
[ -f $HOME/.config/pip/pip.conf ] && mv $HOME/.config/pip/pip.conf $HOME/.config/pip/pip.conf.bak | |
echo '[global]' > $HOME/.config/pip/pip.conf | |
echo 'index-url = https://mirrors.aliyun.com/pypi/simple' >> $HOME/.config/pip/pip.conf | |
echo '' >> $HOME/.config/pip/pip.conf | |
pyenv virtualenv $PYVER supervisor | |
# Done | |
unset PYVER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yum install zlib-devel openssl-devel