Installation

Python Version

We recommend using the latest version of Python 3. Werkzeug supportsPython 3.4 and newer and Python 2.7.

Dependencies

Werkzeug does not have any direct dependencies.

Optional dependencies

These distributions will not be installed automatically. Werkzeug willdetect and use them if you install them.

  • SimpleJSON is a fast JSON implementation that is compatible withPython’s json module. It is preferred for JSON operations if it isinstalled.
  • termcolor provides request log highlighting when using thedevelopment server.
  • Watchdog provides a faster, more efficient reloader for thedevelopment server.

Virtual environments

Use a virtual environment to manage the dependencies for your project,both in development and in production.

What problem does a virtual environment solve? The more Pythonprojects you have, the more likely it is that you need to work withdifferent versions of Python libraries, or even Python itself. Newerversions of libraries for one project can break compatibility inanother project.

Virtual environments are independent groups of Python libraries, one foreach project. Packages installed for one project will not affect otherprojects or the operating system’s packages.

Python 3 comes bundled with the venv module to create virtualenvironments. If you’re using a modern version of Python, you cancontinue on to the next section.

If you’re using Python 2, see Install virtualenv first.

Create an environment

Create a project folder and a venv folder within:

  1. mkdir myproject
  2. cd myproject
  3. python3 -m venv venv

On Windows:

  1. py -3 -m venv venv

If you needed to install virtualenv because you are on an older versionof Python, use the following command instead:

  1. virtualenv venv

On Windows:

  1. \Python27\Scripts\virtualenv.exe venv

Activate the environment

Before you work on your project, activate the corresponding environment:

  1. . venv/bin/activate

On Windows:

  1. venv\Scripts\activate

Your shell prompt will change to show the name of the activatedenvironment.

Install Werkzeug

Within the activated environment, use the following command to installWerkzeug:

  1. pip install Werkzeug

Living on the edge

If you want to work with the latest Werkzeug code before it’s released,install or update the code from the master branch:

  1. pip install -U https://github.com/pallets/werkzeug/archive/master.tar.gz

Install virtualenv

If you are using Python 2, the venv module is not available. Instead,install virtualenv.

On Linux, virtualenv is provided by your package manager:

  1. # Debian, Ubuntu
  2. sudo apt-get install python-virtualenv
  3.  
  4. # CentOS, Fedora
  5. sudo yum install python-virtualenv
  6.  
  7. # Arch
  8. sudo pacman -S python-virtualenv

If you are on Mac OS X or Windows, download get-pip.py, then:

  1. sudo python2 Downloads/get-pip.py
  2. sudo python2 -m pip install virtualenv

On Windows, as an administrator:

  1. \Python27\python.exe Downloads\get-pip.py
  2. \Python27\python.exe -m pip install virtualenv

Now you can continue to Create an environment.