Home >Backend Development >Python Tutorial >Python (and NumPy) development environment setup in Mac OS
1. Install Python 2.7 and NumPy 1.7
1) Download Python 2.7 from http://www.python.org.
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 note: There are many versions of the NumPy installation package. If you use Python 3.x, you should download the corresponding version in NumPy 1.8. NumPy 1.8 supports Python 3.x.
2. Configure Eclipse
1) Click the "Install New Software..." command in the "Help" menu.
2) Click the "Add..." button, set "Name" to "PyDev", set "Location" to "http://pydev.org/updates", and then click "Next" twice Complete the installation of the PyDev plugin.
3) Click the "Preferences..." command in the "Eclipse" menu.
4) Expand "PyDev"->"Editor"->"Interpreter-Python" and click the "Auto Config" button to automatically complete the configuration.
3. 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 the "Run" button on the toolbar, the output is as follows:
[[ 0.87426813 0.98394215 0.72677505 0.39443449]
[ 0.42239815 0.92607431 0.11 464106 0.51409459]
[ 0.07018371 0.08231519 0.45609681 0.61857015]
[ 0.67095948 0.81756795 0.70544254 0.89399634]]
Category: Default category