linux下pyenv安装

1. 安装环境

[root@localhost ~]# yum install lbzip2 openssl-devel readline-devel  bzip2-libs gcc sqlite-devel bzip2-devel  openssl-libs zlib -y

2. 在线安装

[root@localhost ~]# curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

3. 脱机安装

[root@localhost ~]# cd /blueicex/soft/
[root@localhost soft]# mkdir pyenv
[root@localhost soft]# git clone https://github.com/pyenv/pyenv.git /blueicex/soft/pyenv/.pyenv/
[root@localhost soft]# git clone https://github.com/pyenv/pyenv-doctor.git /blueicex/soft/pyenv/.pyenv/plugins/pyenv-doctor
[root@localhost soft]# git clone https://github.com/pyenv/pyenv-installer.git /blueicex/soft/pyenv/.pyenv/plugins/pyenv-installer
[root@localhost soft]# git clone https://github.com/pyenv/pyenv-update.git /blueicex/soft/pyenv/.pyenv/plugins/pyenv-update
[root@localhost soft]# git clone https://github.com/pyenv/pyenv-virtualenv.git /blueicex/soft/pyenv/.pyenv/plugins/pyenv-virtualenv
[root@localhost soft]# git clone https://github.com/pyenv/pyenv-which-ext.git /blueicex/soft/pyenv/.pyenv/plugins/pyenv-which-ext
[root@localhost soft]# cd pyenv
[root@localhost pyenv]# pwd
/blueicex/soft/pyenv
[root@localhost pyenv]# tar cvfj   pyenv.tar.gz .
[root@localhost pyenv]# tar xvf pyenv.tar.gz  -C /usr/share/pyenv/
[root@localhost pyenv]# mkdir /usr/share/pyenv/.pyenv/cache -pv
[root@localhost pyenv]# echo 'export PYENV_ROOT="/usr/share/pyenv/.pyenv/"' >> ~/.bashrc
[root@localhost pyenv]# echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
[root@localhost pyenv]# echo 'eval "$(pyenv init -)"'>> ~/.bashrc
[root@localhost pyenv]# echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
[root@localhost pyenv]# source  ~/.bashrc

3. 脱机安装python

[root@localhost ~]# cd /usr/share/pyenv/.pyenv/cache 
[root@localhost cache]# lftp 192.168.1.3
lftp 192.168.1.3:~> get Py                      
PyMySQL-0.9.3.tar.gz  Python-3.6.7.tar.xz  Python-3.6.9.tgz	Python-3.8.1.tar.xz
Python-3.5.7.tar.xz   Python-3.6.7.tgz	   Python-3.7.4.tar.xz	Python-3.8.1.tgz
Python-3.5.7.tgz      Python-3.6.9.tar.xz  Python-3.7.4.tgz
lftp 192.168.1.3:~> mget Python* 
lftp 192.168.1.3:/> exit
[root@localhost cache]# ls
Python-3.5.7.tar.xz  Python-3.6.7.tar.xz  Python-3.6.9.tar.xz  Python-3.7.4.tar.xz  Python-3.8.1.tar.xz
Python-3.5.7.tgz     Python-3.6.7.tgz     Python-3.6.9.tgz     Python-3.7.4.tgz     Python-3.8.1.tgz
[root@localhost cache]# pyenv install 3.8.1 -v
[root@localhost cache]# pyenv install  3.5.7  -v && pyenv install 3.6.7  -v && pyenv install  3.6.9  -v && pyenv install  3.7.4 -v   && pyenv install  3.8.1 -v
[root@localhost cache]# pyenv versions
* system (set by /usr/share/pyenv/.pyenv/version)
  3.5.7
  3.6.7
  3.6.9
  3.8.1
[root@localhost cache]# pyenv virtualenv 3.8.1 python3.8 && pyenv virtualenv 3.6.9 python3.6  &&  pyenv virtualenv 3.5.7 python3.5

————Blueicex 2020/07/27 17:21 [email protected]

你可能感兴趣的:(Python)