問題描述
安裝舊版本的 Python 以在 Mac OS X 上進行測試 (Install older versions of Python for testing on Mac OS X)
I have Mac OS X 10.5.7 with Python 2.5. I need to test a package I am working on with Python 2.3 for compatibility. I don't want to downgrade my whole system so is there a way to do an install of Python 2.3 that does not change the system python?
‑‑‑‑‑
參考解法
方法 1:
You have two main options, install the python 2.3 from macports (easy) or install from source.
For macports, run port install python23
For the 2nd, you'll have to go to http://www.python.org/download/releases/2.3.7/ to download the source tarball. Once you have that open a terminal and run ./configure ‑‑prefix /home/(your homedir)/software MACOSX_DEPLOYMENT_TARGET=10.5
then make
and make install
. This should place a separate install in the software directory that you can access directly.
方法 2:
This page has useful information on building python from source. It's talking about 3.0, but the advice will probably apply to 2.3 as well.
方法 3:
You can also use the Fink package manager and simply to "fink install python2.3".
If you need Python 2.3 to be your default, you can simply change /sw/bin/python and /sw/bin/pydoc to point to the version you want (they sit in /sw/bin/).
方法 4:
One alternative is to use a virtual machine.
With something like VMWare Fusion or Virtualbox you could install a complete Linux system with Python2.3, and do your testing there. The advantage is that it would be completely sand‑boxed, so wouldn't affect your main system at all.
(by Aaron、Dana the Sane、John Fouhy、Eric O Lebigot、Daniel Roseman)