美文网首页
Linux下快速安装不同版本的python

Linux下快速安装不同版本的python

作者: StephenZ | 来源:发表于2017-11-09 11:40 被阅读0次

前言

在Linux系统中, 由于部分软件需要用到python2.7. 所以, Linux系统中都会有python2.7, 对于想使用python3的同学, 提供了一下的方法, 快速安装多版本python. pyenv是一款很好用的python多版本管理器, 以下介绍快速使用方法.
安装过程遇到问题,欢迎留言,一起解决

安装步骤

  1. 安装git
    yum install -y git
  2. clone pyenv
    git clone https://github.com/pyenv/pyenv.git ~/.pyenv
  3. 更改环境变量
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
$ source ~/.bash_profile
## 安装python
# 查看可安装列表
pyenv install --list
# 安装python 3.6.2
pyenv install 3.6.2

说明

pyenv 会将python安装到${pyenv_root}/versions下面

相关文章

网友评论

      本文标题:Linux下快速安装不同版本的python

      本文链接:https://www.haomeiwen.com/subject/iyepmxtx.html