CentOS配置多版本python

2018-03-19  本文已影响0人  10点睡7点起

文件下载地址

链接:https://pan.baidu.com/s/1AFpCf__PgGq7pSNWry6qGg 密码:c7da


CentOS环境配置

CentOS 软件安装之yum配置


pyenv安装

pyenv可以管理多个版本的python,可以保证生成环境中的多个项目中python版本独立,便于发布管理。

  1. 安装git工具:yum install -y git
  2. 安装依赖项:yum -y install gcc make patch gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2-devel
  3. 创建python用户:useradd python && passwd python
  4. 切换python用户登陆
  5. 安装pyenv:curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
    注:如果提示错误 "curl: (35) SSL connect error“,需要将下面的源添加到yum配置文件中:

[updates]
name=CentOS-Updates
baseurl=https://mirrors.aliyun.com/centos/6.9/os/x86_64
gpgcheck=0

  1. 在python用户的 .bash_profile文件中添加环境变量如下:

export PATH="/home/python/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"


pyenv使用简介


pip包管理

[global]
index-url=https://mirrors.aliyun.com/pypi/simple/
trusted-host=mirrors.aliyun.com

jupyter使用

上一篇 下一篇

猜你喜欢

热点阅读