pyenv离线安装python各版本

1.问题描述:

可能是国内的网络原因,在线用pyenv安装python老是定住没反应

[root@zabbix ~]# pyenv install 3.6.
Downloading Python-3.6..tar.xz...
-> https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz

2.安装配置

安装前需要在pyenv目录下创建cache文件夹,没有的情况

[root@zabbix ~]# cd ~/.pyenv/
[root@zabbix .pyenv]# mkdir cache

下载离线包利用wget,需要进入cache目录下

[root@zabbix cache]# wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
---- ::-- https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
Resolving www.python.org (www.python.org)... 151.101.108.223, 2a04:4e42:::
Connecting to www.python.org (www.python.org)|151.101.108.223|:... connected.
HTTP request sent, awaiting response... OK
Length: (16M) [application/octet-stream]
Saving to: ‘Python-3.6..tar.xz’ % [========================================================>] ,90,204 .3KB/s eta 76s

然后查看目录下有没有python的tar包

[root@zabbix cache]# ls
Python-3.6..tar.xz

查看到已经下载成功以后再用pyenv安装python

[root@zabbix ~]# pyenv install 3.6.
Installing Python-3.6....
Installed Python-3.6. to /root/.pyenv/versions/3.6.

最后查看是否安装成功

[root@zabbix ~]# pyenv versions
* system (set by /root/.pyenv/version)
3.6.
上一篇:红外协议


下一篇:Spring注解@ResponseBody,@RequestBody