Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Installing Python °²×°Python


   
You are here: Home ‣ Dive Into Python 3 ‣
Difficulty level: ♦♢♢♢♢
Installing Python °²×°Python
❝ Tempora mutantur nos et mutamur in illis. (Times change, and we change with them.) ❞
— ancient Roman proverb
 
Diving In
Welcome to Python 3. Let's dive in. In this chapter, you'll install the version of Python 3 that's right for you.
Which Python Is Right For You?  Äĸö°æ±¾ÊʺÏÄã
The first thing you need to do with Python is install it. Or do you?
If you're using an account on a hosted server, your ISP may have already installed Python 3. If you’re running Linux at home, you may already have Python 3, too. Most popular GNU/Linux distributions come with Python 2 in the default installation; a small but growing number of distributions also include Python 3. Mac OS X includes a command-line version of Python 2, but as of this writing it does not include Python 3. Microsoft Windows does not come with any version of Python. But don’t despair! You can point-and-click your way through installing Python, regardless of what operating system you have.ÈÃÔÛÃÇ×Ô¼ºÀ´°²×°Python£¬ÎÞÂÛÄãËùÓõÄÊÇʲôϵͳ¡£
The easiest way to check for Python 3 on your Linux or Mac OS X system is to get to a command line. On Linux, look in your Applications menu for a program called Terminal. (It may be in a submenu like Accessories or System.) On Mac OS X, there is an application called Terminal.app in your /Application/Utilities/ folder.
Once you’re at a command line prompt, just type python3 (all lowercase, no spaces) and see what happens. On my home Linux system, Python 3 is already installed, and this command gets me into the Python interactive shell.
ÔÚÃüÁîÐÐÏÂÊäÈë python3 £¬À´¼ì²éÊÇ·ñ°²×°ÁËpython3
mark@atlantis:~$ python3
Python 3.0.1+ (r301:69556, Apr 15 2009, 17:25:52)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>


Ïà¹ØÎĵµ£º

Python Ö®ìø

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 t ......

ÓÃpythonµÄcmdÄ£¿éдһ¸ö¼òµ¥µÄshell

 from cmd import *
class MyShell(Cmd):
    def preloop(self):
        print "print this line before entering the loop"
            
    def postloop(self):
&nb ......

Python×°ÊÎÆ÷

Ô­ÎÄ£ºhttp://www.klipdas.com/blog/?p=python-decorator
python×°ÊÎÆ÷½éÉÜ
Python 2.2ÖÐÒýÈëµÄ classmethod() ºÍ staticmethod() ÄÚÖú¯Êý£¬Äã¿ÉÒÔÕâÑùµ÷ÓÃclassmethod()£º
class A:
def foo(self, y):
print y
foo = classmethod(foo)
Ò²¿ÉÒÔÕâÑù£º
class A:
@classmethod
def foo(sel ......

Python IDE±È½ÏÓëÍƼö¡¾z¡¿

 ÎÒÏȸøÒ»¸ö³õ²½µÄ±í¸ñ°É£¬´ó¼ÒÈç¹ûÓÐʲôÒâ¼û£¬»òÓв¹³ä£¬»¶Ó­Ìá³ö¡£ÓÐЩÎÒûÓÐÓùý£¬ÏȲ»Ð´ÁË¡£
ÒÔÏÂÊÇÎÒʹÓùýµÄpython IDE:
     
³ýÁËPythonWin, VisualPythonÖ»Ö§³ÖWindows£¬ÆäËü¶¼ÖÁÉÙÖ§³ÖWin/Linux/Mac¡£
¸÷ÏÒ壺
×Ô¶¯²¹È«£º±äÁ¿/º¯ÊýÃû´òµ½Ò»°ëʱ£¬Ìáʾ¿ÉÄܵÄÍêÕûµÄ±äÁ¿/º¯ÊýÃû¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ