This is a small guide on how to install the basic tools for Python development (including OpenGL) on Mac OS X Lion. For this howto, we will be using macports to install all dependencies.
Requirements
Installing the basics (Python 2.7.2 and OpenGL)
- Install macports using the instruction on the macports site (pick the Lion dmg package)
- Install python opengl for python 2.7. This will automatically build Python 2.7.2 and all dependencies. It might take a while to compile…
$ sudo port install py27-opengl
- Install PyOpenGL accelerate.
$ sudo port install py27-opengl-accelerate
- Change the default python interpreter (Apple) to the one from Macports.
$ sudo port select python python27
Optional packages
Cairo
$ sudo port install cairo
$ sudo port install py27-cairo
OpenGL extras
- OpenGLContext
- PyVRML97
- PyDispatcher
- To install the packages above, unzip them to separate folders and install them one by one by running the following command in the folders:
$ sudo python setup.py install
igraph network analysis
$ sudo port install py27-igraph $ cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_math_igraph/igraph/work/igraph-0.5.4 $ sudo CC=/usr/bin/gcc-4.2 CXX=/usr/bin/g++-4.2 ./configure $ cd ~ $ sudo port install py27-igraph |
Test igraph in python
$ python Python 2.7.2 (default, Jul 28 2011, 03:26:08) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import igraph.test >>> igraph.test.test() testAdjacency (igraph.test.basic.BasicTests) ... ok testEdgeAdjacency (igraph.test.basic.BasicTests) ... ok testGraphCreation (igraph.test.basic.BasicTests) ... ok ... testIsBipartite (igraph.test.bipartite.BipartiteTests) ... ok testAdvancedGradientPalette (igraph.test.colortests.ColorTests) ... ok testGradientPalette (igraph.test.colortests.ColorTests) ... ok ---------------------------------------------------------------------- Ran 137 tests in 0.624s OK >>> |
Thank you. Use your method, I successfully setup PyOpenGL on my Mac OSX 10.8.4.
14 Aug 2013 |