# Installing Twisted

## Installation

If you are on Windows, you may want to skip this and simply get the Windows Installer version of Twisted from the download page.

If you are on Debian. you may want to use the Debian packages. The last stable release of Twisted is at deb http://twistedmatrix.com/users/moshez/apt ./, and the last prerelease of Twisted is at deb http://twistedmatrix.com/users/moshez/snapshot ./

To install Twisted, just make sure the `Twisted-$VERSION/` directory is in the `PYTHONPATH` environment variable. For example, if you extracted Twisted-1.0.5.tar.gz to /home/bob/, then you would have something like:

    export PYTHONPATH=$PYTHONPATH:/home/bob/Twisted-1.0.5/

in your `~/.bash_profile`, `~/.zshrc`, `~/.cshrc`, etc. If you use Windows NT, 2000, or XP, then set your environment variables by right-clicking on My Computer and selecting Properties, then the Advanced tab, and click on the Environment Variables button. If you use some other version of windows, you'll need to set the variable at a command prompt, or in autoexec.bat, with the 'set' command.

If you'd like to install Twisted system-wide on your machine and into the default `PYTHONPATH`, you can use `setup.py` to do so:

    # python ./setup.py install

Be sure to run `setup.py` with appropriate privileges (root under Unix).

## Optional Compilation

There are a couple of small optional alternative implementations of pieces of Twisted that are in C for increased performance. If you don't run the installer, and you need these modules, you'll need to perform a couple of extra steps:

    $ python ./setup.py build_ext

This will (eventually) generate some shared libraries (cBanana.so, cReactor.so) within a directory tree called 'build' under the Twisted directory.

If you don't go on to install the build results into a directory on the `$PYTHONPATH`, then you will need to create a couple of symlinks:

    $ cd twisted/spread
    $ ln -s ../../build/lib.linux-i686-2.1/twisted/spread/cBanana.so cBanana.so
    $ cd ../internet
    $ ln -s ../../build/lib.linux-i686-2.1/twisted/internet/cReactor.so cReactor.so

The exact details of the symlinks may vary based on your system.

## Running Tests

See our unit tests run, proving that the software is BugFree(TM):

    % admin/runtests

(From the directory where Twisted was originally untarred/unzipped to.)

Some of these tests will fail if you don't have the Crypto packages installed on your system.