1
00:00:00,240 --> 00:00:06,780
In this lesson we will go through the steps to set up Python development environment on your Mac.

2
00:00:06,780 --> 00:00:12,360
If you are using a Windows computer skip the video and go on to the next video which is dedicated for

3
00:00:12,360 --> 00:00:14,450
Windows setup.

4
00:00:14,520 --> 00:00:21,010
We will be installing these four items on the screen if you already have them installed on your computer.

5
00:00:21,030 --> 00:00:23,430
You can also skip this video.

6
00:00:23,580 --> 00:00:30,230
We will start installing X code through Python 3 and parts Ahmadi.

7
00:00:30,420 --> 00:00:37,050
As I mentioned in the beginning if you prefer a different idea E which is not pi term that is okay.

8
00:00:37,500 --> 00:00:40,620
Now let's start by installing X code.

9
00:00:41,070 --> 00:00:51,040
Go to the App Store search for X code using the search bar you will find the X code app on the top.

10
00:00:51,040 --> 00:00:58,630
Since I have already downloaded the app on my computer this button says open in your screen it should

11
00:00:58,630 --> 00:01:04,890
say get like this button click on the Get button to start downloading the app.

12
00:01:04,960 --> 00:01:10,250
Once you start downloading it may take up to an hour depending on your computer.

13
00:01:10,450 --> 00:01:13,200
You will be able to know if you've finished downloading.

14
00:01:13,210 --> 00:01:20,830
Once the button turns to open once you complete downloading click on the open button you will see an

15
00:01:20,830 --> 00:01:25,150
agreement pop up click on agree to continue.

16
00:01:25,150 --> 00:01:27,100
You might be asked for your password.

17
00:01:27,310 --> 00:01:30,820
So enter your Mac password and click on enter.

18
00:01:31,150 --> 00:01:33,820
Then stalling process will begin.

19
00:01:33,820 --> 00:01:35,160
This may take some time.

20
00:01:35,170 --> 00:01:38,970
So skip to the screen after the process is finished.

21
00:01:39,130 --> 00:01:44,380
Once you've finished installing the X code app the screen should be like this.

22
00:01:44,770 --> 00:01:49,270
Since we won't be developing with X code we can close the app store.

23
00:01:49,530 --> 00:01:56,010
Also go to the left top corner and click on X code choose quit X code on the bottom.

24
00:01:56,030 --> 00:01:58,420
Text.

25
00:01:58,530 --> 00:02:01,540
Next we will be installing homebrew.

26
00:02:01,800 --> 00:02:09,970
Open your web browser and go to H2 T.P. colon slash slash brew dot S H.

27
00:02:10,020 --> 00:02:14,310
Once you go to the site you will see a command in the middle of the screen.

28
00:02:14,370 --> 00:02:17,780
Copy the command and minimize the screen.

29
00:02:17,850 --> 00:02:20,880
Next we need to open up a terminal.

30
00:02:20,880 --> 00:02:28,140
Go to the file and click on new finder window click on applications and scroll down to find utilities

31
00:02:30,770 --> 00:02:31,640
and utilities.

32
00:02:31,640 --> 00:02:37,880
You will be able to find terminal once you click on terminal you will see a window pop up like this

33
00:02:38,870 --> 00:02:40,370
for a shorter access.

34
00:02:40,370 --> 00:02:45,220
I advise you to set this terminal and the shortcuts in the terminal.

35
00:02:45,220 --> 00:02:50,210
We will paste the command which we copied earlier then press enter.

36
00:02:50,830 --> 00:02:57,010
You will receive a message asking you to press the return key you press the return.

37
00:02:57,010 --> 00:03:03,420
Now we'll ask you to enter your Mac password once you typed the password and press the return key again.

38
00:03:03,460 --> 00:03:07,010
The Homebrew will start to install.

39
00:03:07,110 --> 00:03:08,910
This may also take some time.

40
00:03:09,120 --> 00:03:15,110
So I'll skip to the screen after the installing has finished you will see that the installation has

41
00:03:15,110 --> 00:03:24,090
finished closed the terminal and will go onto installing Python 3 hoping your web browser and go to

42
00:03:24,090 --> 00:03:26,040
HD TTP Colin.

43
00:03:26,040 --> 00:03:29,740
Slash slash w w w dot python.

44
00:03:29,760 --> 00:03:37,730
Dot org click on the download tab and press the yellow button that says download Python three point

45
00:03:37,730 --> 00:03:39,390
seven point two.

46
00:03:39,590 --> 00:03:46,440
Your computer will start the process in this lesson we are downloading from the official Web site.

47
00:03:46,510 --> 00:03:52,330
If you have previously downloaded python from a different source like Anaconda and the python version

48
00:03:52,330 --> 00:03:58,750
is close to Python three point seven That will also work for you once you've downloaded the package.

49
00:03:58,760 --> 00:04:01,670
You can click on it to launch the installer.

50
00:04:01,880 --> 00:04:04,120
Let's minimize the browsers so you can see better.

51
00:04:05,120 --> 00:04:09,310
Once then solar is launched go on pressing the continue button.

52
00:04:09,650 --> 00:04:17,200
You will be asked to agree on the licence so he'd agree and continue finally you will see the install

53
00:04:17,200 --> 00:04:17,590
button.

54
00:04:17,590 --> 00:04:18,470
So click on it.

55
00:04:19,660 --> 00:04:26,570
In my case I've set a fingerprint authentication so when installing something this window pops up.

56
00:04:26,620 --> 00:04:30,600
If you don't have it set you will be starting the installation right away.

57
00:04:31,580 --> 00:04:36,140
Once you've finished installation you can close this window.

58
00:04:36,140 --> 00:04:43,170
You wouldn't be needing the installer anymore so you can choose to move it to trash next we want to

59
00:04:43,170 --> 00:04:46,680
check if python has been installed properly.

60
00:04:46,680 --> 00:04:54,860
Let's open the terminal again in the terminal type in Python 3 and press return if python three point

61
00:04:54,860 --> 00:04:56,840
seven point two comes up.

62
00:04:56,840 --> 00:05:00,260
This means installation was successfully done.

63
00:05:00,260 --> 00:05:03,910
Here we've started a shell so you can press control D.

64
00:05:03,920 --> 00:05:13,480
To exit to check where Python 3 has been installed you can type in which Python 3 and press return you

65
00:05:13,480 --> 00:05:16,840
will see which library it's installed.

66
00:05:16,930 --> 00:05:23,180
Now let's go onto installing Python IDC in this lesson we will be installing pi charm.

67
00:05:23,200 --> 00:05:28,680
Idc if you prefer using a different IDC you can do so.

68
00:05:28,750 --> 00:05:32,790
Another great option will be the Visual Studio code idc.

69
00:05:33,010 --> 00:05:38,150
This is free and you can use multiple programming languages like Python and go.

70
00:05:38,800 --> 00:05:45,130
It's becoming one of the best IDC that is out there in the market for free so you can consider using

71
00:05:45,130 --> 00:05:47,230
this idea as well.

72
00:05:47,250 --> 00:05:52,960
Some say that the setup process is a bit confusing in my lessons.

73
00:05:52,960 --> 00:05:58,360
I'll be using pi term since it's easy to set up and the visual is easy to understand which makes it

74
00:05:58,360 --> 00:06:00,220
best for teaching.

75
00:06:00,220 --> 00:06:04,320
But as I said you can choose any I.D. you prefer.

76
00:06:04,690 --> 00:06:13,130
If you choose to use pi term you can hit the download button here pi charm has two types of options.

77
00:06:13,270 --> 00:06:15,950
The professional will cost you the license fee.

78
00:06:16,270 --> 00:06:19,310
You see that the fee is one ninety nine per year.

79
00:06:19,480 --> 00:06:24,460
If you wouldn't be using a lot of features you can stick to the community virgin.

80
00:06:24,460 --> 00:06:27,880
I will be using the professional version in this lesson.

81
00:06:27,880 --> 00:06:33,490
There may be a slight difference in the layout if you will be using the community version but I don't

82
00:06:33,490 --> 00:06:35,350
think it will bother you too much.

83
00:06:38,890 --> 00:06:45,070
Once you've finished downloading you can click it on this tab to launch the installer lets minimize

84
00:06:45,070 --> 00:06:51,820
the browser here we can drag the PI charm icon into the folder icon to finish the installation

85
00:06:55,950 --> 00:07:03,760
once you finish installing pi charm right click on it to launch I'll close all these other windows once

86
00:07:03,760 --> 00:07:11,650
the PI term is launched click on Create new project and this window we will choose pure Python on the

87
00:07:11,650 --> 00:07:12,000
top.

88
00:07:14,370 --> 00:07:16,680
Here we can create the name of the project.

89
00:07:16,950 --> 00:07:23,580
In this lesson we will be programming drums so we can set it to p y Tello with the name of the drone.

90
00:07:24,330 --> 00:07:25,610
If you don't like this name.

91
00:07:25,620 --> 00:07:28,560
Feel free to change it to any project name you wish.

92
00:07:29,610 --> 00:07:32,850
Next click on project interpreter.

93
00:07:32,850 --> 00:07:36,840
The default setting will be set to use virtual EMV.

94
00:07:36,840 --> 00:07:42,420
You may not be familiar with it so we will be using the python three point seven point two which we

95
00:07:42,420 --> 00:07:51,060
just installed choose existing interpreter and click on the dots now choose sys interpreter located

96
00:07:51,060 --> 00:07:52,010
on the left side.

97
00:07:54,770 --> 00:08:02,510
The default interpreter will be showing you as are slash local slash bins slash Python three point seven.

98
00:08:02,660 --> 00:08:08,720
If you scroll down you will see Python 2.0 something which is the python version originally installed

99
00:08:08,750 --> 00:08:13,970
when you bought your Mac the Python 3 in your libraries the one we just install now.

100
00:08:14,580 --> 00:08:21,030
But this is just a link to us our slash local slash and burn slash Python 3.

101
00:08:21,040 --> 00:08:26,140
Here we will set the interpreter to this python 3 by choosing this.

102
00:08:26,140 --> 00:08:32,260
Once we install a newer version of Python the computer will automatically choose the newer python version

103
00:08:34,010 --> 00:08:36,260
once we are done setting the interpreter here.

104
00:08:36,350 --> 00:08:41,860
OK as you see that the existing interpreter is set as Python 3.

105
00:08:42,060 --> 00:08:44,210
You can click on Create.

106
00:08:44,550 --> 00:08:47,790
You may find this tutorial window but we'll just skip it.

107
00:08:50,930 --> 00:08:56,780
Here I want you to check the left side corner of the screen where you will find pea y tallow which is

108
00:08:56,780 --> 00:08:59,720
the project name we created earlier.

109
00:08:59,720 --> 00:09:06,340
Right click on the P1 Tello and choose new then choose new python file.

110
00:09:06,340 --> 00:09:10,660
Let's set the file name to Main and press okay.

111
00:09:10,810 --> 00:09:14,470
And this file we will set to print test to run this code.

112
00:09:14,470 --> 00:09:18,610
We need to set the configuration on your right corner.

113
00:09:18,610 --> 00:09:23,950
You will find and configuration click on it to open up this window.

114
00:09:25,120 --> 00:09:28,750
Click on the plus button and choose python.

115
00:09:28,790 --> 00:09:33,040
You can set the name to whatever is easy for you to understand.

116
00:09:33,110 --> 00:09:38,170
In this example I will set it to go.

117
00:09:38,210 --> 00:09:40,280
Now we need to choose the script path.

118
00:09:40,940 --> 00:09:47,990
If you click on the file icon on the right you will see main dot P Y which we created earlier.

119
00:09:47,990 --> 00:09:55,510
Now press open check to see if the Python interpreter is set to Python three point seven.

120
00:09:55,790 --> 00:10:04,260
If it is all correct click OK after you added the configuration you will see a green triangle icon on

121
00:10:04,260 --> 00:10:08,360
the right corner once you click on the Green Triangle.

122
00:10:08,380 --> 00:10:14,790
The process will start you will find the results of your script on the bottom of the screen.

123
00:10:14,980 --> 00:10:19,390
Once you've completed all these steps you are done setting up your environment.

124
00:10:21,960 --> 00:10:27,840
Although we have completed all the steps there are a few more setting changes that I will make for you

125
00:10:27,900 --> 00:10:30,310
so you can see my script better.

126
00:10:30,600 --> 00:10:34,530
If you prefer these changes feel free to adjust your settings as well.

127
00:10:35,710 --> 00:10:41,240
I click on PI term located on the left corner of the screen and choose preferences.

128
00:10:41,280 --> 00:10:45,980
Now choose appearances the default theme is set to a dark color.

129
00:10:45,990 --> 00:10:48,750
So I will change it to light and apply.

130
00:10:49,890 --> 00:10:54,150
You will see that the entire screen changed to a brighter color.

131
00:10:54,150 --> 00:11:02,120
Also I will go on to choose editor here all choose font and change the font size to 30.

132
00:11:02,160 --> 00:11:04,670
I'm doing these changes for the purpose of teaching.

133
00:11:04,680 --> 00:11:12,040
So if you are fine with the default settings you do not have to make these adjustments.

134
00:11:12,040 --> 00:11:15,140
I also want to introduce you to the debugger function.

135
00:11:15,550 --> 00:11:19,460
Let's set a variable a with 10 and print a.

136
00:11:19,720 --> 00:11:24,820
You can click the blank next to the number and you will see this red circle up here.

137
00:11:24,850 --> 00:11:30,300
Now go onto the right corner to find a bug shape button once you press this button.

138
00:11:30,400 --> 00:11:37,930
You will be a debugger mind the process will stop at the breakpoint which is where you set the red circle.

139
00:11:37,930 --> 00:11:44,170
You can see the value set in variable a and also see the result showing the bottom part of your screen.

140
00:11:44,710 --> 00:11:50,380
You can use this debugger mode to check how the script is processing and also find any errors that you

141
00:11:50,380 --> 00:11:57,250
may have made and the lessons we will mainly be using the screen button to run the script.

142
00:11:57,490 --> 00:12:00,060
And this debugger mod.

143
00:12:00,460 --> 00:12:04,300
These features will be supported in the community version.

144
00:12:04,300 --> 00:12:12,030
So for those of you who will not be using more features you don't have to get the professional version.

145
00:12:12,160 --> 00:12:17,680
Let me clear the breakpoint and go onto the view on the top left of the screen.

146
00:12:17,680 --> 00:12:20,240
Here you will find toolbar.

147
00:12:20,380 --> 00:12:25,770
Once you click this you will see that the buttons have moved to the left side here.

148
00:12:25,840 --> 00:12:28,950
You will also see some more functions.

149
00:12:29,020 --> 00:12:35,720
Earlier I had this green triangle button to run the script but you can also set a shortcut key.

150
00:12:36,040 --> 00:12:39,430
Go to the PI chime and choose preferences.

151
00:12:39,430 --> 00:12:43,610
Choose key map and search run using the search bar.

152
00:12:44,170 --> 00:12:49,110
You can find run and the default short key set to f 10.

153
00:12:49,120 --> 00:12:54,880
I can change the settings by double clicking on run choose keyboard shortcut here.

154
00:12:54,880 --> 00:12:59,190
I will change the shortcut to control R and set the second stroke.

155
00:12:59,200 --> 00:13:03,970
Also to stroke are then hit ok again.

156
00:13:04,150 --> 00:13:09,420
OK to go back to the script.

157
00:13:09,620 --> 00:13:16,250
Currently we are in debugger mode so we need to hit this red square button to exit the debugger mode.

158
00:13:16,280 --> 00:13:20,290
Now I can hit control are twice to run the script.

159
00:13:20,420 --> 00:13:22,510
You can see that the result is showing.

160
00:13:22,640 --> 00:13:26,090
Even though I did not hit the Green Triangle button.

161
00:13:26,090 --> 00:13:30,070
Feel free to change the shortcut key to whatever key that works best for you.

162
00:13:31,190 --> 00:13:34,730
OK finally we've completed setting up the environment.

163
00:13:34,730 --> 00:13:38,420
Now let's go onto the next lesson and start programming the drones.
