Pyenv安装步骤:
Step 1.安装git及其依赖包。yum源为本地系统光盘。
[[email protected] ~]# yum -y install git [[email protected] ~]# yum -y install gcc make patch gdbm-devel openssl-devel sqlite-devel zlib-devel bzip2-devel readline-devel
Step 2.添加python用户
[[email protected] ~]# useradd python [[email protected] ~]# echo "[email protected]" | passwd --stdin python
Step 3.使用python用户登陆系统,执行安装命令
[[email protected] ~]$ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
笔者在安装过程中出现如下错误:
[[email protected] ~]$ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 104 2099 104 2099 0 0 319 0 0:00:06 0:00:06 --:--:-- 5437 Initialized empty Git repository in /home/python/.pyenv/.git/ error: while accessing https://github.com/yyuu/pyenv.git/info/refs
解决方法:
Step 1.开启GIT_CURL_VERBOSE,获取更多错误提示
[[email protected] ~]$ export GIT_CURL_VERBOSE=1
Step 2.重新执行安装命令,定位出错原因
[[email protected] ~]$ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash <------此处忽略若干输出------> * NSS error -12286 * Expire cleared * Closing connection #0 error: while accessing https://github.com/yyuu/pyenv.git/info/refs fatal: HTTP request failed
注:问题出在NSS的版本过低。
Step 3.配置阿里源,更新nss
[[email protected] ~]# wget -O /etc/yum.repos.d/Alibaba.repo http://mirrors.aliyun.com/repo/Centos-6.repo [[email protected] ~]# yum update nss
Setp 4.再次执行安装命令即可。
[[email protected] ~]$ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash