CentOS 7 安裝python3.6.1

來源:互聯網
上載者:User

標籤:檢查   python3   linu   pre   copy   lib   make   figure   edits   

 

說明:CentOS 7迷你安裝,預設Python 2.7 ,開發需要安裝python3.6.1 。

 

1、檢查python版本

[[email protected] ~]# python -V
Python 2.7.5
[[email protected] ~]#

2、安裝必要的庫檔案

  # yum -y install zlib zlib-devel gcc

3、下載python3.6.1到/usr/local目錄

  # wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz

4、解壓安裝

  # xz -d Python-3.6.1.tar.xz

  # tar -xvf Python-3.6.1.tar

  # cd Python-3.6.1/

  # ./configure prefix=/usr/local/python3

  # make && make install

5、永久添加環境變數

  # vim/etc/profile

  添加 export PATH="$PATH:/usr/local/python3/bin"

  添加完成後 source /etc/profile

  **臨時添加環境變數為 # export PATH="$PATH:/usr/local/python3/bin" 終端結束後環境變數生效

6、開啟python3.6

[[email protected] ~]# python3
Python 3.6.1 (default, May 19 2017, 04:11:00)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

7、修改/usr/bin/python連結

  # cd/usr/bin

  # mv python python.bak

  # ln -s /usr/local/python3/bin/python3.6 /usr/bin/python

  # ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3

  修改後可直接用 # python開啟python3

 

CentOS 7 安裝python3.6.1

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.