在Linux下安裝Python的操作相當簡單,按如下步驟操作即可:
1、 在官方網站下載python安裝包,這裡注意python.org/download路徑被屏蔽,需要使用http://www.python.org/頁面上的中文“下載”鏈接進行下載。
這裡下載了python最新的3.2.2版本:Python-3.2.2.tgz
下載後,文件目錄在/home/python/下,這也是我python的安裝目錄
2、 解壓:
[[email protected] python]# tar zxvf Python-3.2.2.tgz
3、 打開安裝目錄,執行:
[[email protected] python]# cd Python-3.2.2
[[email protected] Python-3.2.2]#./configure
[[email protected] Python-3.2.2]# make
[[email protected] Python-3.2.2]# makeinstall
值此,安裝完成。
4、 但此時輸入”python”命令,仍然顯示是舊版本的,這就需要創建軟連接:
[[email protected] bin]# cd /usr/bin
[[email protected] bin]# ll |grep python
[[email protected] bin]# rm -rf python
[[email protected] bin]# ln -s /home/python/Python-3.2.2/python python
[[email protected] bin]# python
Python 3.2.2 (default, Oct 26 2011, 23:40:16)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or"license" for more information.
>>>