1
00:00:00,000 --> 00:00:03,990
So now we are going to install Python and Eclipse on a Mac.

2
00:00:04,000 --> 00:00:07,990
So this is the Python download page, and you will see I have already downloaded

3
00:00:08,000 --> 00:00:12,990
Python 3.1.2 Mac OS X Installer Disk Image.

4
00:00:13,000 --> 00:00:16,990
So if you are on a Mac, that's the one that you want to download.

5
00:00:17,000 --> 00:00:19,990
If the version number is a little bit higher, if it's a later version, go ahead

6
00:00:20,000 --> 00:00:23,990
and install the later version. That should work just fine.

7
00:00:24,000 --> 00:00:28,990
Then you want to download from the Eclipse download page, and Eclipse is written

8
00:00:29,000 --> 00:00:32,990
in Java, and it's actually a Java development environment, and so you will see

9
00:00:33,000 --> 00:00:34,990
that there are a lot of different choices.

10
00:00:35,000 --> 00:00:37,990
If you are a Java developer and you want to install one of these other ones,

11
00:00:38,000 --> 00:00:39,990
that's fine. Go ahead and do that.

12
00:00:40,000 --> 00:00:42,990
For my purposes, I am just getting the Eclipse Classic, because I am really just

13
00:00:43,000 --> 00:00:46,990
using it for Python development today. And you'll notice that when I run the

14
00:00:47,000 --> 00:00:50,990
mouse over this, it highlights the one for Mac OS X Cocoa, and that's really the

15
00:00:51,000 --> 00:00:52,990
one that you want to install.

16
00:00:53,000 --> 00:00:56,990
So I have already downloaded that as well, and here is my Downloads folder, and I

17
00:00:57,000 --> 00:01:00,990
have got the Eclipse downloaded, and I have the Python downloaded.

18
00:01:01,000 --> 00:01:06,990
So go ahead and close the browser, and we are going to start by installing Python.

19
00:01:07,000 --> 00:01:09,990
So I will double-click on the installer, and I will double-click on the

20
00:01:10,000 --> 00:01:15,990
Python.mpkg, and I will say Continue, and Continue, and Continue,

21
00:01:16,000 --> 00:01:18,990
and Agree, and Install.

22
00:01:19,000 --> 00:01:21,990
I am going to install this in default location. Type in my Password.

23
00:01:22,000 --> 00:01:27,990
Mac OS X already comes with Python installed, but it's Python 2, and so you

24
00:01:28,000 --> 00:01:32,990
really need to install Python 3 for this course, because this course is about Python 3.

25
00:01:33,000 --> 00:01:39,990
That installation is done, and I can unmount this, and I just want to go ahead

26
00:01:40,000 --> 00:01:47,990
and go out to my Applications folder, and then I will find Python 3.1 folder, and

27
00:01:48,000 --> 00:01:52,990
in there, you'll find IDLE. And I am going to drag that to my Doc because we are

28
00:01:53,000 --> 00:01:54,990
going to be using that.

29
00:01:55,000 --> 00:01:59,990
I will go ahead and we'll open it, so it's Python 3.1.2, and that's what we are looking for.

30
00:02:00,000 --> 00:02:02,990
So Python is installed and working on this Mac.

31
00:02:03,000 --> 00:02:07,990
I will Quit IDLE, and we are going to go ahead now and install Eclipse.

32
00:02:08,000 --> 00:02:11,990
So I am going to double-click on the Eclipse installer, and this is going to

33
00:02:12,000 --> 00:02:16,990
unarchive it. And it will unarchive the tar file, which is inside of the gz file.

34
00:02:17,000 --> 00:02:19,990
And I have got this folder, and all I need to do with at this point is drag this

35
00:02:20,000 --> 00:02:23,990
whole folder to my applications folder and I come in here, and I am going to find

36
00:02:24,000 --> 00:02:27,990
the folder called Eclipse, and inside of that folder there is the Eclipse

37
00:02:28,000 --> 00:02:32,990
application. I am going to drag that to my dock and run it.

38
00:02:33,000 --> 00:02:34,990
So you go ahead and open that.

39
00:02:35,000 --> 00:02:38,990
Now there are a few things we need to do to configure Eclipse. First thing, we

40
00:02:39,000 --> 00:02:41,990
are going to select a workspace. I am going to allow the default; you are

41
00:02:42,000 --> 00:02:43,990
welcome to use whatever folder works for you.

42
00:02:44,000 --> 00:02:47,990
I am going to select the check box to use it as a default, so it doesn't ask me again.

43
00:02:48,000 --> 00:02:52,990
Now before I do anything else, when Eclipse starts up, under the Help menu, I am

44
00:02:53,000 --> 00:02:57,990
going to go to Install New Software, and I am going to select this link. This is

45
00:02:58,000 --> 00:03:03,990
Available Software Sites, and I am going to add one, and this is for Pydev, and

46
00:03:04,000 --> 00:03:09,990
the URL is pydev.org/updates, with an s at the end.

47
00:03:10,000 --> 00:03:15,990
Say OK, and we see that gets added there, and I say OK, and then all I need

48
00:03:16,000 --> 00:03:20,990
to do is select that is go up here and type Pydev, and just the first couple of

49
00:03:21,000 --> 00:03:26,990
letters, and I will get this here, and I can double-click on that, Pending, and it finds Pydev.

50
00:03:27,000 --> 00:03:31,990
So you want to check Pydev. You don't need to check the Mylyn integration, unless

51
00:03:32,000 --> 00:03:36,990
you know what that is, and you are going to be using that. And I will select Next,

52
00:03:37,000 --> 00:03:42,990
PyDev for Eclipse, and Next. And I want to accept the terms of the license and

53
00:03:43,000 --> 00:03:44,990
Finish, and here we go.

54
00:03:45,000 --> 00:03:49,990
This should take just a moment. At the security warning, you want to say OK, and

55
00:03:50,000 --> 00:03:53,990
it is strongly recommended that you restart Eclipse. There is no reason not to.

56
00:03:54,000 --> 00:03:57,990
So I am just going to select Yes, and Eclipse will restart.

57
00:03:58,000 --> 00:04:00,990
So now I am going to go ahead, and I am going to go to the Workbench. That's this

58
00:04:01,000 --> 00:04:04,990
icon over here at the right, and I am going to maximize this on my workspace.

59
00:04:05,000 --> 00:04:07,990
You will see over here we have Java selected.

60
00:04:08,000 --> 00:04:12,990
I am going to select Other and Pydev and OK, and because I am not going to

61
00:04:13,000 --> 00:04:17,990
be doing any Java development, I am just going to right-click on Java and select Close.

62
00:04:18,000 --> 00:04:21,990
Then I can move this over, and there is my Pydev Workspace.

63
00:04:22,000 --> 00:04:28,990
Now before we get started, we need to go into Preferences, and under Pydev and

64
00:04:29,000 --> 00:04:34,990
Interpreter Python, we need to add our Python Interpreter, and this is so Pydev

65
00:04:35,000 --> 00:04:39,990
knows where to look for Libraries, what sort of Grammar to use, things like that.

66
00:04:40,000 --> 00:04:47,990
So I am going to go ahead and add it. I am going. It's under browse user > local > bin >

67
00:04:48,000 --> 00:04:53,990
python 3.1, and that's an alias, and it's supposed to be. And so when I say OK, it

68
00:04:54,000 --> 00:04:56,990
actually goes and it finds what the alias was pointing at.

69
00:04:57,000 --> 00:04:59,990
Under interpreter name, I am just going to type Python 3.1.

70
00:05:00,000 --> 00:05:03,990
I am going to say OK, and it will say OK.

71
00:05:04,000 --> 00:05:07,990
Now if you are also going to be doing Python 2 development, you might want to

72
00:05:08,000 --> 00:05:09,990
add that interpreter as well.

73
00:05:10,000 --> 00:05:12,990
I know I am not going to be, so I am going to leave it like this.

74
00:05:13,000 --> 00:05:16,990
So now I say OK, and it goes and it finds all of the frameworks, and it finds all

75
00:05:17,000 --> 00:05:20,990
the libraries, and it does all of this stuff, and now that's installed.

76
00:05:21,000 --> 00:05:23,990
So we are getting closer. At this point, we want to go back into the

77
00:05:24,000 --> 00:05:30,990
Preferences, and under Pydev and under Editor, see this thing that says Hover,

78
00:05:31,000 --> 00:05:32,990
and see it's a Show docstrings?

79
00:05:33,000 --> 00:05:35,990
I uncheck that. I find that very distracting.

80
00:05:36,000 --> 00:05:38,990
It's up to you if you want to uncheck that or not.

81
00:05:39,000 --> 00:05:43,990
What it does is whenever you hover over an object in Python, it will show you the

82
00:05:44,000 --> 00:05:46,990
entire documentation, and it will pop up for that object.

83
00:05:47,000 --> 00:05:51,990
I am sure some people find that very helpful. I find that it gets in the way, so I uncheck that.

84
00:05:52,000 --> 00:05:58,990
Also, up here in General and under Editors and Text Editors, I want to

85
00:05:59,000 --> 00:05:59,990
check, Show line numbers.

86
00:06:00,000 --> 00:06:04,990
I find that very useful, and I think you will too. So now we say OK.

87
00:06:05,000 --> 00:06:10,990
Over here in the Pydev Package Explorer, right-click and say New > Project, and

88
00:06:11,000 --> 00:06:15,990
select Pydev and select Pydev Project and Next.

89
00:06:16,000 --> 00:06:20,990
And under Interpreter, you want to select the Python 3.1 Interpreter, and under

90
00:06:21,000 --> 00:06:25,990
Grammar Version, you want to select 3.0, and make sure it says Python for the

91
00:06:26,000 --> 00:06:28,990
project type, and type in the name of project.

92
00:06:29,000 --> 00:06:34,990
I am going to call this Python 3 Essential Training, and select Finish.

93
00:06:35,000 --> 00:06:40,990
Now I have this project here, and I want to right-click on the project and say,

94
00:06:41,000 --> 00:06:44,990
New > Folder, and the parent folder will already be selected as Python 3

95
00:06:45,000 --> 00:06:50,990
Essential Training, and then select the Advanced button and select Link to folder in the system.

96
00:06:51,000 --> 00:06:57,990
Now I am going to select Browse, and on my desktop, I have my Exercise Files folder.

97
00:06:58,000 --> 00:07:00,990
So you want to select that wherever it is you put yours. I find the desktop to

98
00:07:01,000 --> 00:07:01,990
be very convenient for this.

99
00:07:02,000 --> 00:07:03,990
I am going to press Open.

100
00:07:04,000 --> 00:07:08,990
And so what this will do is this will add my Exercise folders to this Project

101
00:07:09,000 --> 00:07:13,990
folder without actually copying the folder. And so it will be just linked to the

102
00:07:14,000 --> 00:07:17,990
folder, and it will use it in place without making another copy of it.

103
00:07:18,000 --> 00:07:20,990
So I am going to say Finish, and there it is.

104
00:07:21,000 --> 00:07:27,990
Now just open up Chapter 02 and double- click on hello.py. And the first time you

105
00:07:28,000 --> 00:07:31,990
open something up after just installing Eclipse and Pydev and everything, it

106
00:07:32,000 --> 00:07:36,990
might take in a moment, and then there it is. We have our Hello, World!

107
00:07:37,000 --> 00:07:38,990
It's a very simple Python program.

108
00:07:39,000 --> 00:07:42,990
The whole purpose of this program is just as an exercise in getting your

109
00:07:43,000 --> 00:07:45,990
development environment running, so it's exactly what it is designed for.

110
00:07:46,000 --> 00:07:51,990
So when I select Run, it will ask me to Run As, and I will select Python Run,

111
00:07:52,000 --> 00:07:55,990
and say OK, and there we have it. There is our result: Hello, World!

112
00:07:56,000 --> 00:08:00,990
So this tells us that Python is installed, that Eclipse is installed, that Pydev

113
00:08:01,000 --> 00:08:06,990
is installed, Python Interpreter is configured within Eclipse and Pydev, and the

114
00:08:07,000 --> 00:08:07,990
entire environment is running.

115
00:08:08,000 --> 00:08:11,990
So now you have a working Eclipse environment where you can follow along with

116
00:08:12,000 --> 00:08:22,000
the exercises and do your own Python development.

