CentOS 6.5 pyenv环境配置

Posted Code as article

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 6.5 pyenv环境配置相关的知识,希望对你有一定的参考价值。

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

 

以上是关于CentOS 6.5 pyenv环境配置的主要内容,如果未能解决你的问题,请参考以下文章

Centos7搭建python+Pyenv虚拟环境

centos中pyenv安装

Python环境搭建

CentOS-6.5环境下配置svn

CentOS 6.5环境下配置Arcgis Server 10.3

生产环境下Centos 6.5优化配置 (装载)