CentOS系統安裝Python3.5的方法

來源:互聯網
上載者:User

方法一,線上安裝

# 下載Python源(Download Python source)
$wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz

# 提取Python包(Extract Python package):
$tar xf Python-3.5.1.tar.xz

$xz -d Python-3.5.1.tar.xz

$cd Python-3.5.1

# 編譯的Python(Compile Python):
$./configure

# Make:
$make

# 安裝(Install):
$make install

# 檢查Python版本(Check Python version):
$which python3.5
/usr/local/bin/python3.5


方法二,另一種安裝方法

1、在官方網站下載python安裝包,這裡注意python.org/download路徑被屏蔽,需要使用http://www.python.org/頁面上的中文“下載”連結進行下載。

這裡下載了python最新的3.2.2版本:Python-3.2.2.tgz

下載後,檔案目錄在/home/python/下,這也是我python的安裝目錄


2、解壓:

[root@www python]# tar zxvf    Python-3.2.2.tgz


3、開啟安裝目錄,執行:

[root@www python]# cd Python-3.2.2

[root@www Python-3.2.2]#./configure

[root@www Python-3.2.2]# make

[root@www Python-3.2.2]# makeinstall

值此,安裝完成。


4、但此時輸入”python”命令,仍然顯示是舊版本的,這就需要建立軟串連:

[root@www bin]# cd /usr/bin

[root@www bin]# ll |grep python

[root@www bin]# rm -rf python

[root@www bin]# ln -s /home/python/Python-3.2.2/python python

[root@www 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.

>>>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.