歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux服務器 >> linux下python安裝

linux下python安裝

日期:2017/3/2 16:34:49   编辑:Linux服務器

1.下載源代碼 http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tar.bz2

  2. 安裝

  $ tar –jxvf Python-2.5.2.tar.bz2

  $ cd Python-2.5.2

  $ ./configure

  $ make

  $ make install

  3. 測試

  在命令行下輸入python,出現python解釋器即表示已經正確安裝。

  在suse10或rhel5(es5)下系統默認已經裝了python但版本是2.4.x;本次安裝後在shell中輸入

  #python

  會發現顯示結果:

  # python

  Python 2.4.3 (#1, Dec 11 2006, 11:38:52)

  [GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2

  Type “help”, “copyright”, “credits” or “license” for more information.

  >>>

  版本還是2.4.x的

  解決辦法:

  #cd /usr/bin

  #ll |grep python //查看該目錄下python

  #rm -rf python

  #ln -s PREFIX/Python-2.5.2/python ./python //PREFIX為你解壓python的目錄

  #python

  # python

  Python 2.5.2 (#1, Dec 11 2006, 11:38:52)

  [GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2

  Type “help”, “copyright”, “credits” or “license” for more information.

  >>>

  OK!問題解決!

Copyright © Linux教程網 All Rights Reserved