Centos7 搭建 Python3.4.1 开发环境

1、安装pyenv

$ git clone git://github.com/yyuu/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
$ exec $SHELL -l

2、安装python x.x.x

(1)查看可安装版本

$ pyenv install --list

(2)安装依赖包

sudo yum install readline readline-devel readline-static
sudo yum install openssl openssl-devel openssl-static
sudo yum install sqlite-devel
sudo yum install bzip2-devel bzip2-libs
$ sudo apt-get install libc6-dev gcc
$ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm
$sudo apt-get install libssl-dev libsqlite3-dev libreadline-gplv2-dev libbz2-dev // Ubuntu15.04 需要安装这些依赖包


(3)安装指定按本(python3.4.1)

$ pyenv install 3.4.1 -v

(4)更新数据库

$ pyenv rehash

(5)查看python版本(检测是否安装)

$ pyenv versions


(6)设置全局的Python版本

$ pyenv global 3.4.1
$ pyenv versions



3、确认Python版本

$ python


4、鸣谢http://seisman.info/python-pyenv.html

你可能感兴趣的:(python,centos)