Skip to content

Instantly share code, notes, and snippets.

@yejiyang
Last active August 29, 2015 14:04
Show Gist options
  • Save yejiyang/76a603c257fcd5674147 to your computer and use it in GitHub Desktop.
Save yejiyang/76a603c257fcd5674147 to your computer and use it in GitHub Desktop.
# KISS Install and use pyenv on CentOS 6.5 (final)
# pyenv => https://github.com/yyuu/pyenv
cd ~
git clone git://github.com/yyuu/pyenv.git .pyenv
echo '# pyenv config' >> ~/.bash_profile
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
source .bash_profile
# fix some dependencies (just in case... I got some erros complaining about this):
# As root
yum install bzip2-devel.x86_64 bzip2-libs.x86_64 bzip2.x86_64
yum install yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
# Install latest 2.7 branch
pyenv install 2.7.6
# after install, show results
which pip
~/.pyenv/shims/pip
which python
~/.pyenv/shims/python
python --version
Python 2.6.6
# still python 2.6.6
# Do this any time you install a new Python binary
pyenv rehash
pyenv versions
* system
2.7.6 (set by ~/.pyenv/version)
python --version
Python 2.6.6
# still python 2.6.6
# Setting system wide Python to 2.7.6
pyenv global 2.7.6
env python --version
Python 2.7.6
pyenv versions
system
* 2.7.6 (set by ~/.pyenv/version)
# Now your shebang should be written this way: (and IMVHO the correct way)
#!/bin/env python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment