如何在Mac OS X Lion中将python 2.6设置为默认值? [英] How can I make python 2.6 my default in Mac OS X Lion?

查看:79
本文介绍了如何在Mac OS X Lion中将python 2.6设置为默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚升级到狮子,随之而来的是Python 2.7.我需要使用2.6作为默认python,因为我主要从事的项目使用2.6.

I just upgraded to lion and with it came Python 2.7. I need to use 2.6 as my default python as the project I primarily work on uses 2.6.

推荐答案

Apple提供了两种非常简单的方法来更改OS X 10.6 Snow Leopard和10.7 Lion上的默认python.在python(1)的Apple手册页中对此进行了详细说明:

Apple has provided two very simple ways to change the default python on OS X 10.6 Snow Leopard and 10.7 Lion. It's all detailed in the Apple man page for python(1):

$ man python
$ which python
/usr/bin/python
$ python -V
Python 2.7.1
#
# temporarily change version
#
$ export VERSIONER_PYTHON_VERSION=2.6
$ python -V
Python 2.6.6
$ unset VERSIONER_PYTHON_VERSION
$ python -V
Python 2.7.1
#
# persistently change version
#
$ defaults write com.apple.versioner.python Version 2.6
$ python -V
Python 2.6.6

这篇关于如何在Mac OS X Lion中将python 2.6设置为默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆