CentOS 7.2 源碼安裝Python 3.6

來源:互聯網
上載者:User

CentOS 7.2 源碼安裝Python 3.6
1.環境

安裝CentOS 7.2最小系統(CentOS-7-x86_64-Minimal-1511.iso)

2.需求

Python-3.6.4.tar.xz(官網下載)

GCC(yum安裝)

一堆開發庫(yum安裝)

3.編譯3.1安裝編譯器
yum -y install gcc
3.2安裝依賴

yum -y install bzip2-devel sqlite-devel openssl-devel readline-devel xz-devel xz-devel tk-devel gdbm-devel
3.3編譯源碼
tar Jxvf Python-3.6.4.tar.xzcd Python-3.6.4./configure

(如果需要發布版,則配置時要開最佳化,編譯較慢./configure --enable-optimizations)
make -j4make install

預設安裝到/usr/local

注意如果不安裝3.2依賴開發庫,則編譯完成後會提示有些模組沒有編譯

Python build finished successfully!The necessary bits to build these optional modules were not found:_bz2                  _curses               _curses_panel      _dbm                  _gdbm                 _lzma              _sqlite3              _ssl                  _tkinter           readline              zlib                                     To find the necessary bits, look in setup.py in detect_modules() for the module's name.The following modules found by detect_modules() in setup.py, have beenbuilt by the Makefile instead, as configured by the Setup files:atexit                pwd                   time               running build_scripts
4.運行
[root@py3 Python-3.6.4]# python3Python 3.6.4 (default, Jan 16 2018, 10:17:58) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linuxType "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.