python安装多版本

时间:2023-03-06 21:16:08

39.107.96.81

root 123123

pyenv#可以实现python多版本控制与切换

pyenv local 3.5.1

ipython#更方便的编写python,可以补全命令彩色显示等功能

  yum -y install gcc gcc-c++ make git patch openssl-devel zlib-devel readline-devel sqlite-devel bzip2-devel

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

  echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc

echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc

echo 'eval "$(pyenv init -)"' >> ~/.bashrc exec $SHELL -l

  yum -y install epel-release

  yum -y install ipython

  git clone git://github.com/yyuu/pyenv.git .pyenv

  

3、配置环境变量:

vim /etc/profile.d/pyenv.sh

添加内容:

export PYENV_ROOT="$HOME/.pyenv"

export PATH="$PYENV_ROOT/bin:$PATH"

if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi

  

  source/etc/profile.d/pyenv.sh

pyenv install 2.7.1    #安装很慢,多等一会,如果想安装3.x以上则更改3.5.1即可

  pip3 install ipython   #可以补全,可以多彩显示

  pip install ipython