1.安装git,github地址为https://github.com/pyenv/pyenv-installer/ yum install git -y
2.安装python编译依赖环境 yum -y install gcc make patch gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2-devel
4.安装pyenv环境 curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
5.在python用户的环境变量目录~/.bash_profile下添加环境变量 export PATH export PATH="/home/python/.pyenv/bin:$PATH" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)"
6.python View version command: Python--version pyenv command: pyenv install-l #列出所有能安装的包 pyenv help Local # Specifies a local pyenv environment in which all subdirectories inherit their properties recursively #指定全局的环境 shell #指定当前会话 install #指定安装的版本 Uninstall #卸载指定的安装环境包 Rehash version #查看当前环境使用的pyenv版本 versions #查看所有的存在的pyenv版本 with * for the current PY Env environment version which whence
7.virtualenv虚拟环境设置 [[email protected] python3.5.3]$ pyenv versions system * 3.5.3 (set by /home/python/python3.5.3/.python-version) 3.6.2 [[email protected] python3.5.3]$ pyenv virtualenv 3.5.3 3-5-3 #将3.5.3版本的python命名为3-5-3的别名 Requirement already satisfied: setuptools in /home/python/.pyenv /versions/3.5.3/envs/3-5-3/lib/python3.5/site-packages Requirement already satisfied: pip in /home/python/.pyenv/versions/3.5.3/envs/3-5-3/lib/python3.5/site-packages [[email protected] python3.5.3]$ pyenv versions system 3-5-3* 3.5.3 (set by /home/python/python3.5.3/.python-version) 3.5.3/envs/3-5-3
Python Learning pyenv Environment Building