-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathinstalling.html
More file actions
391 lines (371 loc) · 23.1 KB
/
installing.html
File metadata and controls
391 lines (371 loc) · 23.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Installing — Matplotlib 1.2.1 documentation</title>
<link rel="stylesheet" href="../_static/mpl.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.2.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Matplotlib 1.2.1 documentation"
href="../_static/opensearch.xml"/>
<link rel="top" title="Matplotlib 1.2.1 documentation" href="../index.html" />
<link rel="up" title="User’s Guide" href="index.html" />
<link rel="next" title="Pyplot tutorial" href="pyplot_tutorial.html" />
<link rel="prev" title="Introduction" href="intro.html" />
<link rel="canonical" href="https://matplotlib.org/stable/users/installing.html" />
<script data-domain="matplotlib.org" defer="defer" src="https://views.scientific-python.org/js/script.js"></script>
</head>
<body>
<div id="unreleased-message"> You are reading an old version of the documentation (v1.2.1). For the latest version see <a href="https://matplotlib.org/stable/users/installing.html">https://matplotlib.org/stable/users/installing.html</a></div>
<!-- Piwik -->
<script type="text/javascript">
if ("matplotlib.sourceforge.net" == document.location.hostname ||
"matplotlib.sf.net" == document.location.hostname) {
var pkBaseURL = (("https:" == document.location.protocol) ? "https://apps.sourceforge.net/piwik/matplotlib/" : "http://apps.sourceforge.net/piwik/matplotlib/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<script type="text/javascript">
if ("matplotlib.sourceforge.net" == document.location.hostname ||
"matplotlib.sf.net" == document.location.hostname) {
piwik_action_name = '';
piwik_idsite = 1;
piwik_url = pkBaseURL + "piwik.php";
piwik_log(piwik_action_name, piwik_idsite, piwik_url);
document.write(unescape('%3Cobject%3E%3Cnoscript%3E%3Cp%3E%3Cimg src="http://apps.sourceforge.net/piwik/matplotlib/piwik.php?idsite=1" alt="piwik"/%3E%3C/p%3E%3C/noscript%3E%3C/object%3E'));
}
</script>
<!-- End Piwik Tag -->
<link rel="shortcut icon" href="_static/favicon.ico">
<!-- The "Fork me on github" ribbon -->
<img style="float: right; margin-bottom: -40px; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" usemap="#ribbonmap"/>
<map name="ribbonmap">
<area shape="poly" coords="15,0,148,-1,148,135" href="https://github.com/matplotlib/matplotlib" title="Fork me on GitHub" />
</map>
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<a href="../index.html"><img src="../_static/logo2.png" border="0" alt="matplotlib"/></a>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pyplot_tutorial.html" title="Pyplot tutorial"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="intro.html" title="Introduction"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">home</a>| </li>
<li><a href="http://www.matplotlib.org/downloads.html">downloads</a>| </li>
<li><a href="../search.html">search</a>| </li>
<li><a href="../examples/index.html">examples</a>| </li>
<li><a href="../gallery.html">gallery</a>| </li>
<li><a href="../citing.html">citation</a>| </li>
<li><a href="../contents.html">docs</a> »</li>
<li><a href="index.html" accesskey="U">User’s Guide</a> »</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../contents.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Installing</a><ul>
<li><a class="reference internal" href="#manually-installing-pre-built-packages">Manually installing pre-built packages</a><ul>
<li><a class="reference internal" href="#general-instructions">General instructions</a></li>
<li><a class="reference internal" href="#installing-on-windows">Installing on Windows</a></li>
</ul>
</li>
<li><a class="reference internal" href="#installing-from-source">Installing from source</a></li>
<li><a class="reference internal" href="#build-requirements">Build requirements</a></li>
<li><a class="reference internal" href="#building-on-osx">Building on OSX</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="intro.html"
title="previous chapter">Introduction</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="pyplot_tutorial.html"
title="next chapter">Pyplot tutorial</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/users/installing.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="installing">
<h1>Installing<a class="headerlink" href="#installing" title="Permalink to this headline">¶</a></h1>
<p>There are many different ways to install matplotlib, and the best way
depends on what operating system you are using, what you already have
installed, and how you want to use it. To avoid wading through all
the details (and potential complications) on this page, the easiest
thing for you to do is use one of the pre-packaged python
distributions that already provide matplotlib built-in. The Enthought
Python Distribution <a class="reference external" href="http://www.enthought.com/products/epd.php">(EPD)</a> for Windows, OS X or
Redhat is an excellent choice that “just works” out of the box.
Another excellent alternative for Windows users is <a class="reference external" href="http://www.pythonxy.com/">Python (x, y)</a> which tends to be updated a bit more
frequently. Both of these packages include matplotlib and pylab, and
<em>lots</em> of other useful tools. matplotlib is also packaged for almost
every major Linux distribution. So if you are on Linux, your package
manager will probably provide matplotlib prebuilt.</p>
<div class="section" id="manually-installing-pre-built-packages">
<h2>Manually installing pre-built packages<a class="headerlink" href="#manually-installing-pre-built-packages" title="Permalink to this headline">¶</a></h2>
<div class="section" id="general-instructions">
<h3>General instructions<a class="headerlink" href="#general-instructions" title="Permalink to this headline">¶</a></h3>
<p>For some people, the prepackaged pythons discussed above are not an
option. That’s OK, it’s usually pretty easy to get a custom install
working. You will first need to find out if you have python installed
on your machine, and if not, install it. The official python builds
are available for download <a class="reference external" href="http://www.python.org/download">here</a>,
but OS X users please read <a class="reference internal" href="../faq/installing_faq.html#which-python-for-osx"><em>Which python for OS X?</em></a>.</p>
<p>Once you have python up and running, you will need to install <a class="reference external" href="http://www.numpy.org/">numpy</a>. numpy provides high-performance array data
structures and mathematical functions, and is a requirement for
matplotlib. You can test your progress:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">numpy</span><span class="o">.</span><span class="n">__version__</span>
</pre></div>
</div>
<p>matplotlib requires numpy version 1.4 or later.
Although it is not a requirement to use matplotlib, we strongly
encourage you to install <a class="reference external" href="http://ipython.org">ipython</a>, which is an
interactive shell for python that is matplotlib-aware.</p>
<p>Next, we need to get matplotlib installed. We provide prebuilt
binaries for OS X and Windows on the matplotlib <a class="reference external" href="https://github.com/matplotlib/matplotlib/downloads/">download</a> page. Click on
the latest release of the “matplotlib” package, choose your python
version (2.6, 2.7 or 3.2) and your platform (macosx or win32). If you
have any problems, please check the <a class="reference internal" href="../faq/installing_faq.html#installing-faq"><em>Installation</em></a>, search
using Google, and/or post a question the <a class="reference external" href="http://sourceforge.net/project/showfiles.php?group_id=80706">mailing list</a>.</p>
<p>If you are on Debian/Ubuntu linux, it suffices to do:</p>
<div class="highlight-python"><pre>> sudo apt-get install python-matplotlib</pre>
</div>
<p>Instructions for installing our OSX binaries are found in the FAQ
<a class="reference internal" href="../faq/installing_faq.html#install-osx-binaries"><em>Installing OSX binaries</em></a>.</p>
<p>Once you have ipython, numpy and matplotlib installed, you can use
ipython’s “pylab” mode to have a MATLAB-like environment that automatically
handles most of the configuration details for you, so you can get up
and running quickly:</p>
<div class="highlight-python"><pre>johnh@flag:~> ipython -pylab
Python 2.4.5 (#4, Apr 12 2008, 09:09:16)
IPython 0.9.0 -- An enhanced Interactive Python.
Welcome to pylab, a matplotlib-based Python environment.
For more information, type 'help(pylab)'.
In [1]: x = randn(10000)
In [2]: hist(x, 100)</pre>
</div>
<p>Note that when testing matplotlib installations from the interactive
python console, there are some issues relating to user interface
toolkits and interactive settings that are discussed in
<a class="reference internal" href="shell.html#mpl-shell"><em>Using matplotlib in a python shell</em></a>.</p>
</div>
<div class="section" id="installing-on-windows">
<h3>Installing on Windows<a class="headerlink" href="#installing-on-windows" title="Permalink to this headline">¶</a></h3>
<p>If you don’t already have python installed, you may want to consider
using the Enthought edition of python, which has scipy, numpy, and
wxpython, plus many other useful packages, preinstalled - <a class="reference external" href="http://www.enthought.com/python">Enthought
Python</a>. With the Enthought
edition of python + matplotlib installer, the following backends
should work out of the box: agg, wx, wxagg, tkagg, ps, pdf and svg.</p>
<p>For standard python installations, you will also need to install numpy
in addition to the matplotlib installer. On some systems you will
also need to download msvcp71.dll library, which you can download from
<a class="reference external" href="http://www.dll-files.com/dllindex/dll-files.shtml?msvcp71">http://www.dll-files.com/dllindex/dll-files.shtml?msvcp71</a> or other
sites. You will need to unzip the archive and drag the dll into
<tt class="file docutils literal"><span class="pre">c:windowssystem32</span></tt>.</p>
<p>All of the GUI backends run on Windows, but TkAgg is probably the
best for interactive use from the standard python shell or ipython.
The Windows installer (<tt class="file docutils literal"><span class="pre">*.exe</span></tt>) on the download page contains all the
code you need to get up and running. However, there are many
examples that are not included in the Windows installer. If you
want to try the many demos that come in the matplotlib source
distribution, download the zip file and look in the <tt class="file docutils literal"><span class="pre">examples</span></tt>
subdirectory.</p>
</div>
</div>
<div class="section" id="installing-from-source">
<span id="install-from-source"></span><h2>Installing from source<a class="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 <a class="reference external" href="https://github.com/matplotlib/matplotlib/downloads">the download page</a>, or if you want
to develop matplotlib or just need the latest bugfixed version, grab
the latest git version <a class="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>
<div class="highlight-python"><pre>cd matplotlib
python setup.py build
python setup.py install</pre>
</div>
<p>We provide a <a class="reference external" href="https://github.com/matplotlib/matplotlib/raw/master/setup.cfg.template">setup.cfg</a>
file that goes with <tt class="file docutils literal"><span class="pre">setup.py</span></tt> 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 <tt class="docutils literal"><span class="pre">setupext.py</span></tt> and add the base
dirs to the <tt class="docutils literal"><span class="pre">basedir</span></tt> dictionary entry for your <tt class="docutils literal"><span class="pre">sys.platform</span></tt>.
e.g., if the header to some required library is in
<tt class="docutils literal"><span class="pre">/some/path/include/someheader.h</span></tt>, put <tt class="docutils literal"><span class="pre">/some/path</span></tt> in the
<tt class="docutils literal"><span class="pre">basedir</span></tt> list for your platform.</p>
</div>
<div class="section" id="build-requirements">
<span id="install-requirements"></span><h2>Build requirements<a class="headerlink" href="#build-requirements" title="Permalink to this headline">¶</a></h2>
<p>These are external packages which you will need to install before
installing matplotlib. Windows users only need the first two (python
and numpy) since the others are built into the matplotlib Windows
installers available for download at <tt class="xref py py-obj docutils literal"><span class="pre">the</span> <span class="pre">download</span> <span class="pre">page</span>
<span class="pre"><https://github.com/matplotlib/matplotlib/downloads>_</span></tt>. If you are
building on OSX, see <a class="reference internal" href="#build-osx"><em>Building on OSX</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>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>If you are on debian/ubuntu, you can get all the dependencies
required to build matplotlib with:</p>
<div class="highlight-python"><pre>sudo apt-get build-dep python-matplotlib</pre>
</div>
<p>If you are on Fedora/RedHat, you can get all the dependencies
required to build matplotlib by first installing <tt class="docutils literal"><span class="pre">yum-builddep</span></tt>
and then running:</p>
<div class="highlight-python"><pre>su -c "yum-builddep python-matplotlib"</pre>
</div>
<p class="last">This does not build matplotlib, but it does get the install the
build dependencies, which will make building from source easier.</p>
</div>
<dl class="docutils">
<dt><a class="reference internal" href="../glossary/index.html#term-python"><em class="xref std std-term">python</em></a> 2.6, 2.7, 3.1 or 3.2</dt>
<dd><a class="reference external" href="http://www.python.org/download/">Download python</a>.</dd>
<dt><a class="reference internal" href="../glossary/index.html#term-numpy"><em class="xref std std-term">numpy</em></a> 1.4 (or later)</dt>
<dd>array support for python (<a class="reference external" href="http://numpy.org">download</a>)</dd>
<dt>libpng 1.2 (or later)</dt>
<dd>library for loading and saving <a class="reference internal" href="../glossary/index.html#term-png"><em class="xref std std-term">PNG</em></a> files (<a class="reference external" href="http://www.libpng.org/pub/png/libpng.html">download</a>). libpng requires
zlib. If you are a Windows user, you can ignore this because we
build support into the matplotlib single-click installer</dd>
<dt><a class="reference internal" href="../glossary/index.html#term-freetype"><em class="xref std std-term">freetype</em></a> 1.4 (or later)</dt>
<dd>library for reading true type font files. If you are a windows
user, you can ignore this since we build support into the
matplotlib single click installer.</dd>
</dl>
<p><strong>Optional</strong></p>
<p>These are optional packages which you may want to install to use
matplotlib with a user interface toolkit. See
<a class="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>
<dl class="docutils">
<dt><a class="reference internal" href="../glossary/index.html#term-tk"><em class="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><a class="reference internal" href="../glossary/index.html#term-pyqt"><em class="xref std std-term">pyqt</em></a> 3.1 or later</dt>
<dd>The Qt3 widgets library python wrappers for the QtAgg backend</dd>
<dt><a class="reference internal" href="../glossary/index.html#term-pyqt"><em class="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><a class="reference internal" href="../glossary/index.html#term-pygtk"><em class="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><a class="reference internal" href="../glossary/index.html#term-wxpython"><em class="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
WX or WXAgg backend</dd>
<dt><a class="reference internal" href="../glossary/index.html#term-pyfltk"><em class="xref std std-term">pyfltk</em></a> 1.0 or later</dt>
<dd>The python wrappers of the FLTK widgets library for use with FLTKAgg</dd>
</dl>
<p><strong>Required libraries that ship with matplotlib</strong></p>
<dl class="docutils">
<dt><a class="reference internal" href="../glossary/index.html#term-agg"><em class="xref std std-term">agg</em></a> 2.4</dt>
<dd>The antigrain C++ rendering engine. matplotlib links against the
agg template source statically, so it will not affect anything on
your system outside of matplotlib.</dd>
<dt><a class="reference internal" href="../glossary/index.html#term-pytz"><em class="xref std std-term">pytz</em></a> 2007g or later</dt>
<dd>timezone handling for python datetime objects. By default,
matplotlib will install pytz if it isn’t already installed on your
system. To override the default, use <tt class="file docutils literal"><span class="pre">setup.cfg</span></tt> to force or
prevent installation of pytz.</dd>
<dt><a class="reference internal" href="../glossary/index.html#term-dateutil"><em class="xref std std-term">dateutil</em></a> 1.1 or later</dt>
<dd>provides extensions to python datetime handling. By default, matplotlib
will install dateutil if it isn’t already installed on your
system. To override the default, use <tt class="file docutils literal"><span class="pre">setup.cfg</span></tt> to force
or prevent installation of dateutil.</dd>
</dl>
</div>
<div class="section" id="building-on-osx">
<span id="build-osx"></span><h2>Building on OSX<a class="headerlink" href="#building-on-osx" title="Permalink to this headline">¶</a></h2>
<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 <tt class="file docutils literal"><span class="pre">README.osx</span></tt>.</p>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pyplot_tutorial.html" title="Pyplot tutorial"
>next</a> |</li>
<li class="right" >
<a href="intro.html" title="Introduction"
>previous</a> |</li>
<li><a href="../index.html">home</a>| </li>
<li><a href="http://www.matplotlib.org/downloads.html">downloads</a>| </li>
<li><a href="../search.html">search</a>| </li>
<li><a href="../examples/index.html">examples</a>| </li>
<li><a href="../gallery.html">gallery</a>| </li>
<li><a href="../citing.html">citation</a>| </li>
<li><a href="../contents.html">docs</a> »</li>
<li><a href="index.html" >User’s Guide</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2013 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the matplotlib development team.
Last updated on May 29, 2013.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
</div>
</body>
</html>