<divid="unreleased-message"> You are reading an old version of the documentation (v1.4.1). For the latest version see <ahref="https://matplotlib.org/stable/users/installing.html">https://matplotlib.org/stable/users/installing.html</a></div>
<h3>Most platforms : scientific Python distributions<aclass="headerlink" href="#most-platforms-scientific-python-distributions" title="Permalink to this headline">¶</a></h3>
<p>The first option is to use one of the pre-packaged python
distributions that already provide matplotlib built-in. The
Continuum.io Python distribution (<aclass="reference external" href="https://store.continuum.io/cshop/anaconda/">Anaconda</a> or <aclass="reference external" href="http://conda.pydata.org/miniconda.html">miniconda</a>) and the Enthought
distribution <aclass="reference external" href="https://www.enthought.com/products/canopy/">(Canopy)</a>
are both excellent choices that “just work” out of the box for
Windows, OSX and common Linux platforms. Both of these distributions
include matplotlib and <em>lots</em> of other useful tools. Another
excellent alternative for Windows users is <aclass="reference external" href="https://code.google.com/p/pythonxy">Python (x, y)</a> .</p>
<p>TkAgg is probably the best backend for interactive use from the
standard Python shell or IPython. It is enabled as the default backend
for the official binaries. GTK3 is not supported on Windows.</p>
<p>The Windows installers (<codeclass="file docutils literal"><spanclass="pre">*.exe</span></code>) and wheels (<codeclass="file docutils literal"><spanclass="pre">*.whl</span></code>) on
the <aclass="reference external" href="http://matplotlib.org/downloads.html">download page</a> do not
contain test data or example code.
If you want to try the many demos that come in the matplotlib source
distribution, download the <codeclass="file docutils literal"><spanclass="pre">*.tar.gz</span></code> file and look in the
<spanid="install-from-source"></span><h2>Installing from source<aclass="headerlink" href="#installing-from-source" title="Permalink to this headline">¶</a></h2>
<p>If you are interested in contributing to matplotlib development,
running the latest source code, or just like to build everything
yourself, it is not difficult to build matplotlib from source. Grab
the latest <em>tar.gz</em> release file from <aclass="reference external" href="http://matplotlib.org/downloads.html">the download page</a>, or if you want
to develop matplotlib or just need the latest bugfixed version, grab
the latest git version <aclass="reference internal" href="../faq/installing_faq.html#install-from-git"><em>Source install from git</em></a>.</p>
<p>Once you have satisfied the requirements detailed below (mainly
python, numpy, libpng and freetype), you can build matplotlib:</p>
<p>We provide a <aclass="reference external" href="https://github.com/matplotlib/matplotlib/raw/master/setup.cfg.template">setup.cfg</a>
file that goes with <codeclass="file docutils literal"><spanclass="pre">setup.py</span></code> which you can use to customize
the build process. For example, which default backend to use, whether
some of the optional libraries that matplotlib ships with are
installed, and so on. This file will be particularly useful to those
packaging matplotlib.</p>
<p>If you have installed prerequisites to nonstandard places and need to
inform matplotlib where they are, edit <codeclass="docutils literal"><spanclass="pre">setupext.py</span></code> and add the base
dirs to the <codeclass="docutils literal"><spanclass="pre">basedir</span></code> dictionary entry for your <codeclass="docutils literal"><spanclass="pre">sys.platform</span></code>.
e.g., if the header to some required library is in
<codeclass="docutils literal"><spanclass="pre">/some/path/include/someheader.h</span></code>, put <codeclass="docutils literal"><spanclass="pre">/some/path</span></code> in the
<codeclass="docutils literal"><spanclass="pre">basedir</span></code> list for your platform.</p>
<divclass="section" id="build-requirements">
<spanid="install-requirements"></span><h3>Build requirements<aclass="headerlink" href="#build-requirements" title="Permalink to this headline">¶</a></h3>
<p>These are external packages which you will need to install before
installing matplotlib. If you are building on OSX, see
<aclass="reference internal" href="#build-osx"><em>Building on OSX</em></a>. If you are building on Windows, see
<aclass="reference internal" href="#build-windows"><em>Building on Windows</em></a>. If you are installing dependencies with a
package manager on Linux, you may need to install the development
packages (look for a “-dev” postfix) in addition to the libraries
themselves.</p>
<divclass="section" id="required-dependencies">
<h4>Required Dependencies<aclass="headerlink" href="#required-dependencies" title="Permalink to this headline">¶</a></h4>
<dlclass="docutils">
<dt><aclass="reference internal" href="../glossary/index.html#term-python"><emclass="xref std std-term">python</em></a> 2.6, 2.7, 3.3 or 3.4</dt>
<dd>Used to manipulate time-zone aware datetimes.</dd>
</dl>
</div>
<divclass="section" id="optional-gui-framework">
<h4>Optional GUI framework<aclass="headerlink" href="#optional-gui-framework" title="Permalink to this headline">¶</a></h4>
<p>These are optional packages which you may want to install to use
matplotlib with a user interface toolkit. See
<aclass="reference internal" href="../faq/usage_faq.html#what-is-a-backend"><em>What is a backend?</em></a> for more details on the optional matplotlib
backends and the capabilities they provide.</p>
<dlclass="docutils">
<dt><aclass="reference internal" href="../glossary/index.html#term-tk"><emclass="xref std std-term">tk</em></a> 8.3 or later</dt>
<dd>The TCL/Tk widgets library used by the TkAgg backend</dd>
<dt><aclass="reference internal" href="../glossary/index.html#term-pyqt"><emclass="xref std std-term">pyqt</em></a> 4.0 or later</dt>
<dd>The Qt4 widgets library python wrappers for the Qt4Agg backend</dd>
<dt><aclass="reference internal" href="../glossary/index.html#term-pygtk"><emclass="xref std std-term">pygtk</em></a> 2.4 or later</dt>
<dd>The python wrappers for the GTK widgets library for use with the
GTK or GTKAgg backend</dd>
<dt><aclass="reference internal" href="../glossary/index.html#term-wxpython"><emclass="xref std std-term">wxpython</em></a> 2.8 or later</dt>
<dd>The python wrappers for the wx widgets library for use with the
<h4>Required libraries that ship with matplotlib<aclass="headerlink" href="#required-libraries-that-ship-with-matplotlib" title="Permalink to this headline">¶</a></h4>
<p>This does not build matplotlib, but it does get the install the
build dependencies, which will make building from source easier.</p>
</div>
<divclass="section" id="building-on-osx">
<spanid="build-osx"></span><h3>Building on OSX<aclass="headerlink" href="#building-on-osx" title="Permalink to this headline">¶</a></h3>
<p>The build situation on OSX is complicated by the various places one
can get the libpng and freetype requirements (darwinports, fink,
/usr/X11R6) and the different architectures (e.g., x86, ppc, universal) and
the different OSX version (e.g., 10.4 and 10.5). We recommend that you build
the way we do for the OSX release: get the source from the tarball or the
git repository and follow the instruction in <codeclass="file docutils literal"><spanclass="pre">README.osx</span></code>.</p>
</div>
<divclass="section" id="building-on-windows">
<spanid="build-windows"></span><h3>Building on Windows<aclass="headerlink" href="#building-on-windows" title="Permalink to this headline">¶</a></h3>
<p>The Python shipped from <aclass="reference external" href="http://www.python.org">http://www.python.org</a> is compiled with Visual Studio
2008 for versions before 3.3 and Visual Studio 2010 for 3.3 and later. Python
extensions are recommended to be compiled with the same compiler. The .NET
Framework 4.0 is required for MSBuild (you’ll likely have the requisite
Framework with Visual Studio). In addition to Visual Studio <aclass="reference external" href="http://www.cmake.org">CMake</a> is required for building libpng.</p>
<p>Since there is no canonical Windows package manager the build methods for
freetype, zlib, libpng, tcl, & tk source code are documented as a build script
at <aclass="reference external" href="https://github.com/jbmohler/matplotlib-winbuild">matplotlib-winbuild</a>.</p>