Home | History | Annotate | Download | only in tutorials
      1 .. _tutorials.installing.packages:
      2 
      3 Installing packages
      4 ===================
      5 To use webapp2 outside of App Engine, you need a package manager to install
      6 dependencies in your system -- mostly WebOb, and maybe libraries required
      7 by the various webapp2_extras modules, if you will use them.
      8 
      9 For App Engine, some webapp2_extras modules may require that you install
     10 external packages to access specific command line tools (i18n, for example,
     11 uses pybabel to extract and compile translation catalogs).
     12 
     13 In this tutorial we'll show how to install a package manager and installer.
     14 
     15 
     16 Install a distutils library
     17 ---------------------------
     18 If you don't have a distutils library (`distribute <http://pypi.python.org/pypi/distribute>`_
     19 or `setuptools <http://pypi.python.org/pypi/setuptools>`_) installed on
     20 you system yet, you need to install one. Distribute is recommended, but
     21 setuptools will serve as well.
     22 
     23 Distribute is "the standard method for working with Python module
     24 distributions". It will manage our package dependencies and upgrades.
     25 If you already have one of them, jump to next step. If not, the installation
     26 is straighforward:
     27 
     28 **1.** Download the installer and save it anywhere. It is a single file:
     29 
     30     http://python-distribute.org/distribute_setup.py
     31 
     32 **2.** Execute it from the command line (this will require sudo if you are
     33 using Linux or a Mac):
     34 
     35 .. code-block:: text
     36 
     37    $ python distribute_setup.py
     38 
     39 If you don't see any error messages, yay, it installed successfully. Let's
     40 move forward. For Windows, check the distribute or setuptools documentation.
     41 
     42 
     43 Install a package installer
     44 ---------------------------
     45 We need a package installer (``pip`` or ``easy_install``) to install and
     46 update Python packages. Any will work, but if you don't have one yet, ``pip``
     47 is recommended. Here's how to install it:
     48 
     49 **1.** Download ``pip`` from PyPi:
     50 
     51     http://pypi.python.org/pypi/pip
     52 
     53 **2.** Unpack it and access the unpacked directory using the command line.
     54 Then run ``setup.py install`` on that directory (this will require sudo if you
     55 are using Linux or a Mac):
     56 
     57 .. code-block:: text
     58 
     59    $ python setup.py install
     60 
     61 That's it. If you don't see any error messages, the ``pip`` command should
     62 now be available in your system.
     63