4
4
Installation
5
5
*************
6
6
7
-
8
7
.. contents ::
9
8
:backlinks: none
10
9
11
-
12
10
Report a compilation problem
13
11
============================
14
12
@@ -181,12 +179,14 @@ OS-X Notes
181
179
Which python for OS X?
182
180
----------------------
183
181
184
- Apple ships OS X with its own python, but it is generally recommended
185
- that users install an independent python system and use that
186
- as the basis for installing libraries such as numpy and
187
- matplotlib. By far the easiest method is to use one
188
- of the excellent python software collections that are now
189
- available:
182
+ Apple ships OS X with its own Python, in ``/usr/bin/python ``, and its own copy
183
+ of matplotlib. Unfortunately, the way Apple currently installs its own copies
184
+ of numpy, scipy and matplotlib means that these packages are difficult to
185
+ upgrade. For that reason we strongly suggest that you install a fresh version
186
+ of Python and use that as the basis for installing libraries such as numpy and
187
+ matplotlib. Once convenient way to install matplotlib with other useful
188
+ Python software is to use one of the excellent Python scientific software
189
+ collections that are now available:
190
190
191
191
- Anaconda _ from `Continuum Analytics `_
192
192
- Canopy _ from Enthought _
@@ -196,94 +196,173 @@ available:
196
196
.. _Enthought : http://enthought.com
197
197
.. _Continuum Analytics : http://continuum.io
198
198
199
- These collections include python itself and a wide range of
200
- libraries; if you need a library that is not available from
201
- the collection, you can install it yourself using standard
202
- methods such as *pip *.
199
+ These collections include Python itself and a wide range of libraries; if you
200
+ need a library that is not available from the collection, you can install it
201
+ yourself using standard methods such as *pip *. Continuum and Enthought offer
202
+ their own installation support for these collections; see the Ananconda and
203
+ Canopy web pages for more information.
204
+
205
+ Other options for a fresh Python install are the standard installer from
206
+ `python.org <https://www.python.org/downloads/mac-osx/ >`_, or installing
207
+ Python using a general OSX package management system such as `homebrew
208
+ <http://brew.sh> `_ or `macports <http://www.macports.org >`_. Power users on
209
+ OSX will likely want one of homebrew or macports on their system to install
210
+ open source software packages, but it is perfectly possible to use these
211
+ systems with another source for your Python binary, such as Anaconda, Canopy
212
+ or Python.org Python.
203
213
204
- If you choose not to use a collection, then you may use an
205
- installer from `python.org
206
- <https://www.python.org/downloads/mac-osx/> `_, or use a
207
- general package management system such as `homebrew
208
- <http://brew.sh> `_ or `macports <http://www.macports.org >`_.
209
- Whatever you choose, choose one and stick with it--don't try
210
- to mix homebrew and macports, for example. You may,
211
- however, use homebrew or macports for all your non-python
212
- software, and still use Anaconda _ or Canopy _ for your python
213
- system.
214
+ .. _install_osx_binaries :
214
215
216
+ Installing OSX binary wheels
217
+ ----------------------------
215
218
219
+ If you are using recent Python from http://www.python.org, Macports or
220
+ Homebrew, then you can use the standard pip installer to install matplotlib
221
+ binaries in the form of wheels.
216
222
217
- .. _install_osx_binaries :
223
+ Python.org Python
224
+ ^^^^^^^^^^^^^^^^^
218
225
219
- Installing OSX binaries
220
- -----------------------
226
+ * Install pip following instructions here: http://pip.readthedocs.org
227
+
228
+ Then::
229
+
230
+ pip install matplotlib
231
+
232
+ Macports
233
+ ^^^^^^^^
234
+
235
+ For Python 2.7::
236
+
237
+ sudo port install py27-pip
238
+ sudo pip-2.7 install matplotlib
239
+
240
+ For Python 3.4::
241
+
242
+ sudo port install py34-pip
243
+ sudo pip-3.4 install matplotlib
244
+
245
+ Homebrew
246
+ ^^^^^^^^
247
+
248
+ For Python 2.7::
249
+
250
+ pip2 install matplotlib
251
+
252
+ For Python 3.4::
221
253
222
- If you want to install matplotlib from one of the binary installers we
223
- build, you have two choices: a mpkg installer, which is a typical
224
- Installer.app, or a binary OSX egg, which you can install via
225
- setuptools' easy_install.
254
+ pip3 install matplotlib
255
+
256
+ You might also want to install IPython; we recommend you install IPython with
257
+ the IPython notebook option, like this:
258
+
259
+ * Python.org Python: ``pip install ipython[notebook] ``
260
+ * Macports ``sudo pip-2.7 install ipython[notebook] `` or ``sudo pip-3.4
261
+ install ipython[notebook] ``
262
+ * Homebrew ``pip2 install ipython[notebook] `` or ``pip3 install
263
+ ipython[notebook] ``
264
+
265
+ Installing via OSX mpkg installer package
266
+ -----------------------------------------
267
+
268
+ matplotlib also has a disk image (``.dmg ``) installer, which contains a
269
+ typical Installer.app package to install matplotlib. You should use binary
270
+ wheels instead of the disk image installer if you can, because:
271
+
272
+ * wheels work with Python.org Python, homebrew and macports, the disk image
273
+ installer only works with Python.org Python.
274
+ * The disk image installer doesn't check for recent versions of packages that
275
+ matplotlib depends on, and unconditionally installs the versions of
276
+ dependencies contained in the disk image installer. This can overwrite
277
+ packages that you have already installed, which might cause problems for
278
+ other packages, if you have a pre-existing Python.org setup on your
279
+ computer.
280
+
281
+ If you still want to use the disk image installer, read on.
226
282
227
283
.. note ::
228
- Before installing any of the binary packages, be sure that all of the
229
- packages were compiled for the same version of python.
230
- Often, the download site for NumPy and matplotlib will display a
231
- supposed 'current' version of the package, but you may need to choose
232
- a different package from the full list that was built for your
233
- combination of python and OSX.
234
-
235
- The mkpg installer will have a "zip" extension, and will have a name
236
- like :file: `matplotlib-1.2.0-py2.7-macosx10.5_mpkg.zip `.
284
+ Before installing via the disk image installer, be sure that all of the
285
+ packages were compiled for the same version of python. Often, the download
286
+ site for NumPy and matplotlib will display a supposed 'current' version of
287
+ the package, but you may need to choose a different package from the full
288
+ list that was built for your combination of python and OSX.
289
+
290
+ The disk image installer will have a ``.dmg `` extension, and will have a name
291
+ like :file: `matplotlib-1.4.0-py2.7-macosx10.5.dmg `.
237
292
The name of the installer depends on which versions of python, matplotlib,
238
- and OSX it was built for. You need to unzip this file using either the
239
- "unzip" command, or simply double clicking on the it. Then when you
240
- double-click on the resulting mpkd, which will have a name like
241
- :file: `matplotlib-1.2.0-py2.7-macosx10.5.mpkg `, it will run the
242
- Installer.app, prompt you for a password if you need system-wide
293
+ and OSX it was built for. You need to download this disk image ``.dmg ``
294
+ file. Next open the disk image file by double clicking, and find the new
295
+ matplotlib disk image icon on your desktop. Double click on that icon to show
296
+ the contents of the image. Then double-click on the ``.mpkg `` icon, which
297
+ will have a name like :file: `matplotlib-1.4.0-py2.7-macosx10.5.mpkg `, it will
298
+ run the Installer.app, prompt you for a password if you need system-wide
243
299
installation privileges, and install to a directory like
244
- :file: `/Library/Python/2.7/site-packages/ ` (exact path depends on your
245
- python version). This directory may not be in your python 'path' variable,
246
- so you should test your installation with::
300
+ :file: `/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages `
301
+ (exact path depends on your Python version).
302
+
303
+ Checking your installation
304
+ --------------------------
305
+
306
+ The new version of matplotlib should now be on your Python "path". Check this
307
+ with one of these commands at the Terminal.app command line::
247
308
248
- > python -c 'import matplotlib; print matplotlib.__version__, matplotlib.__file__'
309
+ python2.7 -c 'import matplotlib; print matplotlib.__version__, matplotlib.__file__'
249
310
250
- If you get an error like::
311
+ (Python 2.7) or::
312
+
313
+ python3.4 -c 'import matplotlib; print(matplotlib.__version__, matplotlib.__file__)'
314
+
315
+ (Python 3.4). You should see something like this::
316
+
317
+ 1.4.0 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.pyc
318
+
319
+ where ``1.4.0 `` is the matplotlib version you just installed, and the path
320
+ following depends on whether you are using Python.org Python, Homebrew or
321
+ Macports. If you see another version, or you get an error like this::
251
322
252
323
Traceback (most recent call last):
253
324
File "<string>", line 1, in <module>
254
325
ImportError: No module named matplotlib
255
326
256
- then you will need to set your PYTHONPATH, eg::
327
+ then check that the Python binary is the one you expected by doing one of
328
+ these commands in Terminal.app::
257
329
258
- export PYTHONPATH=/Library/Python/2.7/site-packages:$PYTHONPATH
330
+ which python2.7
259
331
260
- See also ref:`environment-variables `.
332
+ or::
333
+
334
+ which python3.4
261
335
336
+ If you get the result ``/usr/bin/python2.7 ``, then you are getting the Python
337
+ installed with OSX, which is probably not what you want. Try closing and
338
+ restarting Terminal.app before running the check again. If that doesn't fix
339
+ the problem, depending on which Python you wanted to use, consider
340
+ reinstalling Python.org Python, or check your homebrew or macports setup.
341
+ Remember that the disk image installer only works for Python.org Python, and
342
+ will not get picked up by other Pythons. If all these fail, please contact
343
+ the mailing list.
262
344
263
345
Windows Notes
264
346
=============
265
347
266
- Recommendation: use one of the excellent multi-platform
267
- python collections which include python itself and a wide
268
- range of libraries including matplotlib:
348
+ We recommend you use one of the excellent python collections which include
349
+ Python itself and a wide range of libraries including matplotlib:
269
350
270
351
- Anaconda _ from `Continuum Analytics `_
271
352
- Canopy _ from Enthought _
353
+ - `Python (x, y) <https://code.google.com/p/pythonxy >`_
272
354
273
- A Windows-only alternative is:
274
-
275
- - `python (x, y) <http://www.pythonxy.com >`_
355
+ Python (X, Y) is Windows-only, whereas Anaconda and Canopy are cross-platform.
276
356
277
357
.. _windows-installers :
278
358
279
- Binary installers for Windows
280
- -----------------------------
359
+ Standalone binary installers for Windows
360
+ ----------------------------------------
281
361
282
- If you have already installed python , you can use one of the
362
+ If you have already installed Python and numpy , you can use one of the
283
363
matplotlib binary installers for windows -- you can get these from the
284
- `download <http://matplotlib.org/downloads.html >`_ site.
285
- Choose the files that match your version of python (eg ``py2.7 `` if
286
- you installed Python 2.7) which have the ``exe `` extension. If you
287
- haven't already installed python, you can get the official version
288
- from the `python web site <http://python.org/download/ >`_.
289
-
364
+ `download <http://matplotlib.org/downloads.html >`_ site. You will first need
365
+ to install Choose the files that match your version of python (eg ``py2.7 `` if
366
+ you installed Python 2.7) which have the ``exe `` extension. If you haven't
367
+ already installed python, you can get the official version from the `python
368
+ web site <http://python.org/download/> `_.
0 commit comments