diff --git a/i/.htaccess b/i/.htaccess index 105c4fb..35a1445 100644 --- a/i/.htaccess +++ b/i/.htaccess @@ -2,4 +2,3 @@ FileETag MTime Size ExpiresActive On ExpiresDefault "access plus 1 year" -Header set Cache-Control "max-age=31536000" diff --git a/installing-python.html b/installing-python.html index 61afa4f..5a9ca6d 100644 --- a/installing-python.html +++ b/installing-python.html @@ -6,6 +6,10 @@ @@ -26,60 +30,174 @@ body{counter-reset:h1 0}

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. Most popular GNU/Linux distributions come with Python 2 in the default installation; a small but growing number of distributions also include Python 3. (As you’ll see in this chapter, you can have more than one version of Python installed on your computer.) Mac OS X includes a command-line version of Python 2, although you'll probably want to install a version that includes a more Mac-like graphical interface. -

Windows does not come with any version of Python, but don’t despair! There are several ways to point-and-click your way to Python on Windows. -

What's more, Python programs written on one platform can run on any supported platform. For instance, I regularly develop Python programs on Windows and later deploy them on Linux. +

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. (As you’ll see in this chapter, you can have more than one version of Python installed on your computer.) 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. + +

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

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

(Type exit and press ENTER to exit the Python interactive shell.) + +

My web hosting provider also runs Linux and provides command-line access, but my server does not have Python 3 installed. (Boo!) + +

+mark@manganese:~$ python3
+bash: python3: command not found
+

So back to the question that started this section, “Which Python is right for you?” The answer is whichever one runs on the computer you already have. +

⁂ +

Installing on Microsoft Windows

-

FIXME -

[Windows dialog: open file security warning] -

[Python installer: select whether to install Python 3.1 for all users of this computer] -

[Python installer: select destination directory] -

[Python installer: customize Python 3.1] -

[Python installer: disk space requirements] -

[Python installer: removing Test Suite option will save 7908KB on your hard drive] -

[Python installer: progress meter] -

[Python installer: installation completed. Special Windows thanks to Mark Hammond, without whose years of freely shared Windows expertise, Python for Windows would still be Python for DOS.] -

[Windows Python Shell, a graphical interactive shell for Python] +

Windows comes in two architectures these days: 32-bit and 64-bit. Of course, there are lots of different versions of Windows — XP, Vista, Windows 7 — but Python runs on all of them. The more important distinction is 32-bit v. 64-bit. If you have no idea what architecture you’re running, it’s probably 32-bit. + +

Visit python.org/download/ and download the appropriate Python 3 Windows installer for your architecture. Your choices will look something like this: + +

+ +

I don’t want to include direct download links here, because minor updates of Python happen all the time and I don’t want to be responsible for you missing important updates. You should always install the most recent version of Python 3.x unless you have some esoteric reason not to. + +

    +
  1. +

    [Windows dialog: open file security warning] +

    Once your download is complete, double-click the .msi file. Windows will pop up a security alert, since you’re about to be running executable code. The official Python installer is digitally signed by the Python Software Foundation, the non-profit corporation that oversees Python development. Don’t accept imitations! +

    Click the Run button to launch the Python 3 installer. + +

  2. +

    [Python installer: select whether to install Python 3.1 for all users of this computer] +

    The first question the installer will ask you is whether you want to install Python 3 for all users or just for you. The default choice is “install for all users,” which is the best choice unless you have a good reason to choose otherwise. (One possible reason why you would want to “install just for me” is that you are installing Python on your company’s computer and you don’t have administrative rights on your Windows account. But then, why are you installing Python without permission from your company’s Windows administrator? Don’t get me in trouble here!) +

    Click the Next button to accept your choice of installation type. + +

  3. +

    [Python installer: select destination directory] + +

  4. +

    [Python installer: customize Python 3.1] + +

  5. +

    [Python installer: disk space requirements] + +

  6. +

    [Python installer: removing Test Suite option will save 7908KB on your hard drive] + +

  7. +

    [Python installer: progress meter] + +

  8. +

    [Python installer: installation completed. Special Windows thanks to Mark Hammond, without whose years of freely shared Windows expertise, Python for Windows would still be Python for DOS.] + +

  9. +

    [Windows Python Shell, a graphical interactive shell for Python] + +

+ +

Installing on Mac OS X

FIXME -

[contents of Python installer disk image] -

[Python installer: welcome screen] -

[Python installer: information about supported architectures, disk space, and acceptable destination folders] -

[Python installer: software license agreement] -

[Python installer: dialog to accept license agreement] -

[Python installer: standard install screen] -

[Python installer: custom install screen] -

[Python installer: dialog to enter administrative password] -

[Python installer: progress meter] -

[Python installer: install succeeded] -

[contents of /Applications/Python 3.1/ folder] -

[Mac Python Shell, a graphical interactive shell for Python] -

[Python Launcher preferences window] + +

    + +
  1. +

    [contents of Python installer disk image] + +

  2. +

    [Python installer: welcome screen] + +

  3. +

    [Python installer: information about supported architectures, disk space, and acceptable destination folders] + +

  4. +

    [Python installer: software license agreement] + +

  5. +

    [Python installer: dialog to accept license agreement] + +

  6. +

    [Python installer: standard install screen] + +

  7. +

    [Python installer: custom install screen] + +

  8. +

    [Python installer: dialog to enter administrative password] + +

  9. +

    [Python installer: progress meter] + +

  10. +

    [Python installer: install succeeded] + +

  11. +

    [contents of /Applications/Python 3.1/ folder] + +

  12. +

    [Mac Python Shell, a graphical interactive shell for Python] + +

  13. +

    [Python Launcher preferences window] + +

+ +

Installing on Ubuntu Linux

FIXME -

[Add/Remove: Canonical-maintained applications] -

[Add/Remove: all open source applications] -

[Add/Remove: search for Python 3] -

[Add/Remove: select Python 3.0 package] -

[Add/Remove: select IDLE for Python 3.0 package] -

[Add/Remove: apply changes] -

[Add/Remove: download progress meter] -

[Add/Remove: installation progress meter] -

[Add/Remove: new applications have been installed] -

[Linux Python Shell, a graphical interactive shell for Python] +

    +
  1. +

    [Add/Remove: Canonical-maintained applications] + +

  2. +

    [Add/Remove: all open source applications] + +

  3. +

    [Add/Remove: search for Python 3] + +

  4. +

    [Add/Remove: select Python 3.0 package] + +

  5. +

    [Add/Remove: select IDLE for Python 3.0 package] + +

  6. +

    [Add/Remove: apply changes] + +

  7. +

    [Add/Remove: download progress meter] + +

  8. +

    [Add/Remove: installation progress meter] + +

  9. +

    [Add/Remove: new applications have been installed] + +

  10. +

    [Linux Python Shell, a graphical interactive shell for Python] + +

+ +

Installing on Other Platforms

FIXME +

⁂ +

Python Editors and IDEs

FIXME diff --git a/table-of-contents.html b/table-of-contents.html index 41fb7ad..3615afe 100644 --- a/table-of-contents.html +++ b/table-of-contents.html @@ -393,6 +393,10 @@ ul li ol{margin:0;padding:0 0 0 2.5em}

  • Views (several dictionary methods return them, they're dynamic, update when the dictionary changes, etc.)
  • Function annotations
  • PEP 8 style conventions +
  • Decorators +
      +
    1. @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows") +
  • Importing modules
    1. ...mention why from module import * is only allowed at module level