Mac OS 10.8 Python (and NumPy) development environment set up

One, the installation of Python 2.7 and NumPy 1.7

1)Download the Python from 2.7.

2)Install Python 2.7.

3)Download the NumPy 1.7 for Mac installation package from http://sourceforge.net/projects/numpy/files/NumPy/.

4)Install NumPy 1.7.  

Additional information: NumPy installation package has many versions, if you use Python 3.x, you should download the corresponding version in NumPy 1.8. NumPy 1.8 Python 3.x.


Two, the configuration of Eclipse

1)Click the “ Help” menu in the “ Install New Software... ” command.

2)Click the “ Add... ” button, set the “ Name” “ PyDev” “ Location”, “ ”, and then click two times “ Next” to complete the PyDev plugin installation.

3)Click the “ Eclipse” menu in the “ Preferences ” command...

4)“ PyDev” -> “ Editor” -> “ Interpreter-Python”, click the “ Auto Config” button, automatically configured.


Three, the sample code

Create a new Python project in Eclipse, add a Python file, and enter the following two lines of code:

import numpy.random;

print(numpy.random.rand(4, 4));

Click &ldquo on the toolbar button, the following output; Run”:

[[ 0.87426813  0.98394215  0.72677505  0.39443449]

 [ 0.42239815  0.92607431  0.11464106  0.51409459]

 [ 0.07018371  0.08231519  0.45609681  0.61857015]

 [ 0.67095948  0.81756795  0.70544254  0.89399634]]

Posted by Murray at November 18, 2013 - 5:34 AM