Skip to content Skip to sidebar Skip to footer

Install Matplotlib 1.2.x On Os X Lion 10.7.4 And Python 3.2.2

I asked a question a couple of days ago regarding installing numpy on the same system. Thankfully, I managed to solve that one myself but unfortunately I am now stuck trying to ins

Solution 1:

Okay...I think have managed to get matplotlib to install now...

  1. First of all you need to install numpy. I have instructions to do this on another post: install numpy

  2. Now open Terminal and clone the git repository for matplotlib (assumes you have git installed):

    • git clone git://github.com/matplotlib/matplotlib.git (this might take a while)
  3. Once the clone is complete open your user folder in Finder

  4. In your user folder open the matplotlib directory

  5. There is a file called `make.osx' open this with TextEdit (or similar)

  6. Change the following lines:

    • MACOSX_DEPLOYMENT_TARGET=10.6
    • OSX_SDK_VER=10.6

    To:

    • MACOSX_DEPLOYMENT_TARGET=10.7
    • OSX_SDK_VER=10.7
  7. Change the following lines:

    • ${PYTHON} -c 'import urllib; urllib.urlretrieve("${ZLIBURL}", "${ZLIBFILE}")' &&\ ${PYTHON} -c 'import urllib; urllib.urlretrieve("${PNGURL}", "${PNGFILE}")' &&\ ${PYTHON} -c 'import urllib; urllib.urlretrieve("${FREETYPEURL}", "${FREETYPEFILE}")'

    To:

    • ${PYTHON} -c 'import urllib.request; urllib.request.urlretrieve("${ZLIBURL}", "${ZLIBFILE}")' &&\ ${PYTHON} -c 'import urllib.request; urllib.request.urlretrieve("${PNGURL}", "${PNGFILE}")' &&\ ${PYTHON} -c 'import urllib.request; urllib.request.urlretrieve("${FREETYPEURL}", "${FREETYPEFILE}")'
  8. Save the changes

  9. Open the file called setupext.py in idle

  10. Find the line 'darwin' : [], and change it to 'darwin' : ['/usr/local'],

  11. Save the file

  12. Open Terminal again and type the following:

    • sudo make -f make.osx PREFIX=/usr/local PYVERSION=3.2 fetch deps mpl_build mpl_install
  13. After some time matplotlib should be installed in the following directory:

    • /usr/local/lib/Python3.2/site-packages/
  14. Open the above directory and also the following directory:

    • /Library/Python/3.2/site-packages/
  15. Copy/move the following directories from /usr/local/lib/Python3.2/site-packages/ to /Library/Python/3.2/site-packages/:

    • dateutil
    • matplotlib
    • mpl_toolkits
  16. matplotlib should be now installed

  17. If you open idle and type import matplotlib it shouldn't return an error

  18. I tried out the matplotlib/examples/user_interfaces/embedding_in_qt4_wtoolbar.py file and it seems works fine

Hope someone else finds this useful!

Thanks again for the assistance,

Adam.

Post a Comment for "Install Matplotlib 1.2.x On Os X Lion 10.7.4 And Python 3.2.2"