[英]Mac OSX: Switch to Python 2.7.3
我安裝了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
但:
$ export VERSIONER_PYTHON_VERSION=2.7
$ python -V
python: VERSIONER_PYTHON_VERSION environment variable error (ignored)
Python 2.6.1
無法切換到2.7! 這是為什么?
python.org安裝將在/ usr / local / bin中放置一個python可執行文件。 Apple的python位於/ usr / bin中
要調用python.org python,您可以使用其完整路徑/ usr / local / bin / python或更改路徑以在/ usr / bin之前放入/ usr / local / bin。 您仍然可以使用其完整路徑/ usr / bin / python來調用Apple的python
一些python安裝,例如Macports提供了一個工具,提供了各種python安裝的符號鏈接,並允許您在它們之間切換。
我不認為我們可以在不使用像MacPorts
或ActivePython
這樣的東西的情況下在Mac OS X上切換python版本。
我認為這是因為VERSIONER_PYTHON_VERSION特定於apple構建的python包。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.