1. 程式人生 > >python版本管理--pyenv

python版本管理--pyenv

python版本環境管理

下載依賴

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

安裝pyenv包

git clone https://github.com/pyenv/pyenv.git ~/.pyenv

設定環境變數

vi ~/.bashrc
新增環境變數:
export PYENV_ROOT="$HOME/.pyenv" 
export PATH="$PYENV_ROOT/bin:$PATH" 
eval "$(pyenv init -)"
重啟環境變數   #source ~/.bashrc

pyenv工具使用

在Linux環境下已經有了pyenv,檢視是否安裝成功
'''
[[email protected] ~]# pyenv
pyenv 1.2.8
Usage: pyenv

Some useful pyenv commands are:
commands List all available pyenv commands
local Set or show the local application-specific Python version
global Set or show the global Python version
shell Set or show the shell-specific Python version
install Install a Python version using python-build
uninstall Uninstall a specific Python version
rehash Rehash pyenv shims (run this after installing executables)
version Show the current Python version and its origin
versions List all Python versions available to pyenv
which Display the full path to an executable
whence List all Python versions that contain the given executable

See `pyenv help