zfyaixue 2020-04-14
系统版本:CentOS Linux release 7.6.1810 (Core)
软件版本:无
硬件要求:无
[ ~]# yum -y install git gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel
[ ~]# git clone https://github.com/pyenv/pyenv.git ~/.pyenv
[ ~]# vim /etc/profile # pyenv export PYENV_ROOT="$HOME/.pyenv" export PATH=$HOME/.pyenv/bin:$PATH eval "$(pyenv init -)" [ ~]# source /etc/profile
[ ~]# pyenv -v pyenv 1.2.18
[ ~]# pyenv install --list
[ ~]# for i in $(grep -r ‘www.python.org‘ ~/.pyenv/*|awk -F ‘:‘ ‘{print $1}‘|grep ‘^/‘);do sed -i ‘s#https://www.python.org/ftp/#https://npm.taobao.org/mirrors/#g‘ $i;done
[ ~]# pyenv install 3.6.9
[ ~]# v=3.6.9;wget https://npm.taobao.org/mirrors/python/$v/Python-$v.tar.xz -P ~/.pyenv/cache/;pyenv install $v
[ ~]# pyenv versions * system (set by /root/.pyenv/version) 3.6.9
[ ~]# pyenv global 3.6.9 [ ~]# python Python 3.6.9 (default, Apr 9 2020, 07:01:31) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> exit()
[ ~]# pyenv uninstall 3.8.0 pyenv: remove /root/.pyenv/versions/3.8.0? yes [ ~]# pyenv versions system * 3.6.9 (set by /root/.pyenv/version)