[英]Mac OSX: Switch to Python 2.7.3
I've installed the Mac OSX Python 2.7.3 , and tried switching to the new version: 我安装了Mac OSX Python 2.7.3 ,并尝试切换到新版本:
$ python2.7 -V
Python 2.7.3 # It was installed
$ python -V
Python 2.6.1 # Default is 2.6
$ export VERSIONER_PYTHON_VERSION=2.5
$ python -V
Python 2.5.4 # I can switch to 2.5
$ export VERSIONER_PYTHON_VERSION=2.6
$ python -V
Python 2.6.1 # And 2.6
But: 但:
$ export VERSIONER_PYTHON_VERSION=2.7
$ python -V
python: VERSIONER_PYTHON_VERSION environment variable error (ignored)
Python 2.6.1
Can't switch to 2.7! 无法切换到2.7! Why is that?
这是为什么?
The python.org install will put a python executable in /usr/local/bin . python.org安装将在/ usr / local / bin中放置一个python可执行文件。 Apple's python is in /usr/bin
Apple的python位于/ usr / bin中
To call the python.org python you can use its full path /usr/local/bin/python or change your path to put /usr/local/bin before /usr/bin. 要调用python.org python,您可以使用其完整路径/ usr / local / bin / python或更改路径以在/ usr / bin之前放入/ usr / local / bin。 You will still be able to call Apple's python by using its full path /usr/bin/python
您仍然可以使用其完整路径/ usr / bin / python来调用Apple的python
Some python installs eg Macports provide a tool that provides symbolic links to various python installs and allows you to switch between them. 一些python安装,例如Macports提供了一个工具,提供了各种python安装的符号链接,并允许您在它们之间切换。
我不认为我们可以在不使用像MacPorts
或ActivePython
这样的东西的情况下在Mac OS X上切换python版本。
我认为这是因为VERSIONER_PYTHON_VERSION特定于apple构建的python包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.