2016年7月18日 星期一

在 CentOS7/RHEL7 上安裝 Python 3.4

設定目標:
  • 在 CentOS7 /RHEL7 上安裝 Python 3.4!

快速設定流程:
  1. 安裝 EPEL:
    #yum install epel-release
    
  2. 安裝 Python 3.4:
    #yum install python34
    
  3. 安裝 Python 3.4 其他相關套件:
    #yum install  python34-setuptools python34-tools
    
  4. 測試 Python 3.4 (一):
    # python3
    Python 3.4.3 (default, Jan 26 2016, 02:25:35)
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> quit()
    
    
  5. 測試 Python 3.4 (二):
    #vim Hello.py
    print("Hello World")
    
    #python3 Hello.py
    Hello World
    
  6. 你應該要知道的 Python 風格
    # python3
    Python 3.4.3 (default, Jan 26 2016, 02:25:35)
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import this
    The Zen of Python, by Tim Peters
    
    Beautiful is better than ugly.
    Explicit is better than implicit.
    Simple is better than complex.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the temptation to guess.
    There should be one-- and preferably only one --obvious way to do it.
    Although that way may not be obvious at first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right* now.
    If the implementation is hard to explain, it's a bad idea.
    If the implementation is easy to explain, it may be a good idea.
    Namespaces are one honking great idea -- let's do more of those!
    >>>