- 在 CentOS7 /RHEL7 上安裝 Python 3.4!
快速設定流程:
-
安裝 EPEL:
#yum install epel-release
-
安裝 Python 3.4:
#yum install python34
-
安裝 Python 3.4 其他相關套件:
#yum install python34-setuptools python34-tools
-
測試 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()
-
測試 Python 3.4 (二):
#vim Hello.py print("Hello World") #python3 Hello.py Hello World
-
你應該要知道的 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! >>>