前提:
1息楔、變更RHEL6.7源為 CENTOS 6源寝贡。可參考文檔RHEL6更換CentOS源
2钞螟、原因:RHEL6可能與CentOS6不同兔甘。
3、本文是在此前提下配置鳞滨,如出現(xiàn)錯誤提示洞焙,請先滿足上述條件后安裝。切勿盲目安裝配置。
開始配置安裝pyenv:
#?yum?groupinstall?"Development?tools"
#?yum?install?zlib-devel?bzip2-devel?openssl-devel?ncurses-devel?\
sqlite-devel?readline-devel?tk-devel?gdbm-devel?db4-devel?libpcap-devel?xz-devel
安裝pyenv
#?git?clone?git://github.com/yyuu/pyenv.git?.pyenv
配置pyenv:
# vim?/etc/profile.d/pyenv.sh
如下代碼:
#!/bin/bash
############################################
#??Name??:?/etc/profile.d/pyenv.sh
#?Author?:?Hisea_Y
#??Date???:?20?Mar?2017
############################################
#?Define?The?Environment?Variable
export?PYENV_ROOT="$HOME/.pyenv"
export?PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv?init?-)"
執(zhí)行:
#?source?/etc/profile.d/pyenv.sh
使用pyenv安裝Python:
#?pyenv?versions?#查看當(dāng)前安裝版本
*?system?(set?by?/root/.pyenv/version)
#?python?-V?#查看系統(tǒng)所安裝的版本
Python?2.6.6
查看可安裝的Python版本:
#?pyenv?install?-l?|?more
選擇安裝最新的2.7.13 以及 較新的3.5.3 (3.6.0 部分插件不支持澡匪,當(dāng)然可以一并安裝)
#?pyenv?install?2.7.13
#?pyenv?install?3.5.3
#?pyenv?install?3.6.0
pip安裝與配置
#?yum?install?python-pip
使用pip安裝IPython
#?pyenv?global??3.5.3
#?pyenv?versions
system
2.7.13
*?3.5.3?(set?by?/root/.pyenv/version)
3.6.0
#?pip?install?ipython
#?ipython
In?[1]:?print?('hello?world')
hello?world
In?[2]:?1/2
Out[2]:?0.5
In?[3]:?exit()
#?pyenv?global?2.7.13
#?pyenv?version
2.7.13?(set?by?/root/.pyenv/version)
#?pip?install?ipython
#?ipython
In?[1]:?print?'hello?world'
hello?world
In?[2]:?1/2
Out[2]:?0
In?[3]:?exit()