gpt4 book ai didi

python - 如何将 python 2.6 设置为 Mac OS X Lion 中的默认设置?

转载 作者:太空狗 更新时间:2023-10-29 17:51:43 25 4
gpt4 key购买 nike

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

最佳答案

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

$ 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

关于python - 如何将 python 2.6 设置为 Mac OS X Lion 中的默认设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6998545/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com