[root@localhost ~]# curl
https://raw.github.com/yyuu/pyenv-installer/master/bin/pyenv-installer|
bash
...
Seems you still have not added ‘pyenv‘ to the
load path:
export PYENV_ROOT="${HOME}/.pyenv"
if [ -d "${PYENV_ROOT}"
]; then
export PATH="${PYENV_ROOT}/bin:${PATH}"
eval "$(pyenv
init -)"
fi
[root@localhost
~]# vim
/etc/profile.d/pyenv.sh
[root@localhost ~]# .
/etc/profile.d/pyenv.sh
2.安装python
例如安装2.7.5版本
[root@localhost ~]# pyenv install 2.7.5
3.利用pyenv进行版本切换
pyenv versions
pyenv local|glocal 2.7.5
pyenv versions
python -V
此处local和glocal的区别在于local仅对当前目录及子目录起作用,glocal是全局生效
4.安装python的增强版本ipython
安装ipython,需要安装pip(python的包管理工具,如果是通过pyenv安装的python,则默认安装pip,否则不会安装)
pip install ipython