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,查看是否安装成功
'''
[root@izm5egnkapo0o29h3bgxa1z ~]# 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

猜你喜欢

转载自www.cnblogs.com/Edwardzhao/p/9980426.html
今日推荐