2013年5月2日 星期四

Debain 安裝 pythonbrew 徹底解脫 Python 的版本問題

筆者很喜歡 Python 這個程式語言,可是在使用上總會遭遇到版本的問題,例如在 Debian 這個作業系統上的 Python 版本總是會比較舊一些,導致有些套件的使用上感到不順手,特別是有些方便的 Package 只有在 Python 2.7.X 以上才能夠使用,偏偏 Python 2.7.X 目前只有升級到 Debian testing 才能夠使用,而筆者目前只想使用 Debian stable(Squeeze) 的套件、系統環境(雖然 testing 也頗為穩定)。

幸好這樣的問題可以靠 pythonbrew 來解決!
pythonbrew is a program to automate the building and installation of Python in the users $HOME.
簡而言之,pythonbrew 可以在不變動到系統主要環境的情況下,將 Python 安裝在一個隔離的路徑下,同時允許多個版本的 Python 存在,令使用者能夠自行切換 Python 版本與安裝不同版本的 Python 套件。

下文就是 pythonbrew 的安裝指令與簡要的使用方法。