1. 程式人生 > >CentOS 6.5 pyenv環境配置

CentOS 6.5 pyenv環境配置

錯誤提示 pos round zip2 bzip received pass access b-

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

CentOS 6.5 pyenv環境配置