CentOS 6.5 pyenv环境配置

Pyenv安装步骤:

Step 1.安装git及其依赖包。yum源为本地系统光盘。

[root@localhost ~]# yum -y install git
[root@localhost ~]# yum -y install gcc make patch gdbm-devel openssl-devel sqlite-devel zlib-devel bzip2-devel readline-devel

Step 2.添加python用户

[root@localhost ~]# useradd python
[root@localhost ~]# echo "p@SSw0rd" | passwd --stdin python

Step 3.使用python用户登陆系统,执行安装命令

[python@localhost ~]$ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash 

笔者在安装过程中出现如下错误:

[python@localhost ~]$ 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,获取更多错误提示

[python@localhost ~]$ export GIT_CURL_VERBOSE=1

Step 2.重新执行安装命令,定位出错原因

[python@localhost ~]$ 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

[root@localhost ~]# wget -O /etc/yum.repos.d/Alibaba.repo http://mirrors.aliyun.com/repo/Centos-6.repo
[root@localhost ~]# yum update nss

Setp 4.再次执行安装命令即可。

[python@localhost ~]$ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

 

posted @ 2018-02-24 23:17  Orcsir  阅读(492)  评论(0编辑  收藏  举报