2

在Mac电脑上安装多版本的Python

 2 years ago
source link: http://cenalulu.github.io/python/multi-version-python-on-mac/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Home Python

在Mac电脑上安装多版本的Python

本文将介绍如何在Mac电脑上实现多个版本的Python共存及切换的方法

申明:本文是Stackoverflow的回答转载和翻译。原文链接

首先通过homebrew安装pyenv,之后的所有Python安装和管理通过pyenv进行。

$ brew install pyenv

pyenv安装完以后,就可以选择性的进行Python环境安装了。下面已安装Python2.7为例:

$ pyenv install 2.7.5

此外,你还可以通过pyenv查看目前系统中已经安装过的Python版本

$ pyenv versions

如果需要在不同版本的Python间进行切换的话,使用以下命令:

$ pyenv global 3.3.1

当然,你也可以让版本切换只对当前目录生效

$ pyenv local 2.7.5

cenalulu(卢钧轶)

Written by cenalulu(卢钧轶)

Updated January 22, 2015


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK