In this lesson we will go through the steps to set up Python development environment on your Mac.
If you are using a Windows computer skip the video and go on to the next video which is dedicated for
Windows setup.
We will be installing these four items on the screen if you already have them installed on your computer.
You can also skip this video.
We will start installing X code through Python 3 and parts Ahmadi.
As I mentioned in the beginning if you prefer a different idea E which is not pi term that is okay.
Now let's start by installing X code.
Go to the App Store search for X code using the search bar you will find the X code app on the top.
Since I have already downloaded the app on my computer this button says open in your screen it should
say get like this button click on the Get button to start downloading the app.
Once you start downloading it may take up to an hour depending on your computer.
You will be able to know if you've finished downloading.
Once the button turns to open once you complete downloading click on the open button you will see an
agreement pop up click on agree to continue.
You might be asked for your password.
So enter your Mac password and click on enter.
Then stalling process will begin.
This may take some time.
So skip to the screen after the process is finished.
Once you've finished installing the X code app the screen should be like this.
Since we won't be developing with X code we can close the app store.
Also go to the left top corner and click on X code choose quit X code on the bottom.
Text.
Next we will be installing homebrew.
Open your web browser and go to H2 T.P. colon slash slash brew dot S H.
Once you go to the site you will see a command in the middle of the screen.
Copy the command and minimize the screen.
Next we need to open up a terminal.
Go to the file and click on new finder window click on applications and scroll down to find utilities
and utilities.
You will be able to find terminal once you click on terminal you will see a window pop up like this
for a shorter access.
I advise you to set this terminal and the shortcuts in the terminal.
We will paste the command which we copied earlier then press enter.
You will receive a message asking you to press the return key you press the return.
Now we'll ask you to enter your Mac password once you typed the password and press the return key again.
The Homebrew will start to install.
This may also take some time.
So I'll skip to the screen after the installing has finished you will see that the installation has
finished closed the terminal and will go onto installing Python 3 hoping your web browser and go to
HD TTP Colin.
Slash slash w w w dot python.
Dot org click on the download tab and press the yellow button that says download Python three point
seven point two.
Your computer will start the process in this lesson we are downloading from the official Web site.
If you have previously downloaded python from a different source like Anaconda and the python version
is close to Python three point seven That will also work for you once you've downloaded the package.
You can click on it to launch the installer.
Let's minimize the browsers so you can see better.
Once then solar is launched go on pressing the continue button.
You will be asked to agree on the licence so he'd agree and continue finally you will see the install
button.
So click on it.
In my case I've set a fingerprint authentication so when installing something this window pops up.
If you don't have it set you will be starting the installation right away.
Once you've finished installation you can close this window.
You wouldn't be needing the installer anymore so you can choose to move it to trash next we want to
check if python has been installed properly.
Let's open the terminal again in the terminal type in Python 3 and press return if python three point
seven point two comes up.
This means installation was successfully done.
Here we've started a shell so you can press control D.
To exit to check where Python 3 has been installed you can type in which Python 3 and press return you
will see which library it's installed.
Now let's go onto installing Python IDC in this lesson we will be installing pi charm.
Idc if you prefer using a different IDC you can do so.
Another great option will be the Visual Studio code idc.
This is free and you can use multiple programming languages like Python and go.
It's becoming one of the best IDC that is out there in the market for free so you can consider using
this idea as well.
Some say that the setup process is a bit confusing in my lessons.
I'll be using pi term since it's easy to set up and the visual is easy to understand which makes it
best for teaching.
But as I said you can choose any I.D. you prefer.
If you choose to use pi term you can hit the download button here pi charm has two types of options.
The professional will cost you the license fee.
You see that the fee is one ninety nine per year.
If you wouldn't be using a lot of features you can stick to the community virgin.
I will be using the professional version in this lesson.
There may be a slight difference in the layout if you will be using the community version but I don't
think it will bother you too much.
Once you've finished downloading you can click it on this tab to launch the installer lets minimize
the browser here we can drag the PI charm icon into the folder icon to finish the installation
once you finish installing pi charm right click on it to launch I'll close all these other windows once
the PI term is launched click on Create new project and this window we will choose pure Python on the
top.
Here we can create the name of the project.
In this lesson we will be programming drums so we can set it to p y Tello with the name of the drone.
If you don't like this name.
Feel free to change it to any project name you wish.
Next click on project interpreter.
The default setting will be set to use virtual EMV.
You may not be familiar with it so we will be using the python three point seven point two which we
just installed choose existing interpreter and click on the dots now choose sys interpreter located
on the left side.
The default interpreter will be showing you as are slash local slash bins slash Python three point seven.
If you scroll down you will see Python 2.0 something which is the python version originally installed
when you bought your Mac the Python 3 in your libraries the one we just install now.
But this is just a link to us our slash local slash and burn slash Python 3.
Here we will set the interpreter to this python 3 by choosing this.
Once we install a newer version of Python the computer will automatically choose the newer python version
once we are done setting the interpreter here.
OK as you see that the existing interpreter is set as Python 3.
You can click on Create.
You may find this tutorial window but we'll just skip it.
Here I want you to check the left side corner of the screen where you will find pea y tallow which is
the project name we created earlier.
Right click on the P1 Tello and choose new then choose new python file.
Let's set the file name to Main and press okay.
And this file we will set to print test to run this code.
We need to set the configuration on your right corner.
You will find and configuration click on it to open up this window.
Click on the plus button and choose python.
You can set the name to whatever is easy for you to understand.
In this example I will set it to go.
Now we need to choose the script path.
If you click on the file icon on the right you will see main dot P Y which we created earlier.
Now press open check to see if the Python interpreter is set to Python three point seven.
If it is all correct click OK after you added the configuration you will see a green triangle icon on
the right corner once you click on the Green Triangle.
The process will start you will find the results of your script on the bottom of the screen.
Once you've completed all these steps you are done setting up your environment.
Although we have completed all the steps there are a few more setting changes that I will make for you
so you can see my script better.
If you prefer these changes feel free to adjust your settings as well.
I click on PI term located on the left corner of the screen and choose preferences.
Now choose appearances the default theme is set to a dark color.
So I will change it to light and apply.
You will see that the entire screen changed to a brighter color.
Also I will go on to choose editor here all choose font and change the font size to 30.
I'm doing these changes for the purpose of teaching.
So if you are fine with the default settings you do not have to make these adjustments.
I also want to introduce you to the debugger function.
Let's set a variable a with 10 and print a.
You can click the blank next to the number and you will see this red circle up here.
Now go onto the right corner to find a bug shape button once you press this button.
You will be a debugger mind the process will stop at the breakpoint which is where you set the red circle.
You can see the value set in variable a and also see the result showing the bottom part of your screen.
You can use this debugger mode to check how the script is processing and also find any errors that you
may have made and the lessons we will mainly be using the screen button to run the script.
And this debugger mod.
These features will be supported in the community version.
So for those of you who will not be using more features you don't have to get the professional version.
Let me clear the breakpoint and go onto the view on the top left of the screen.
Here you will find toolbar.
Once you click this you will see that the buttons have moved to the left side here.
You will also see some more functions.
Earlier I had this green triangle button to run the script but you can also set a shortcut key.
Go to the PI chime and choose preferences.
Choose key map and search run using the search bar.
You can find run and the default short key set to f 10.
I can change the settings by double clicking on run choose keyboard shortcut here.
I will change the shortcut to control R and set the second stroke.
Also to stroke are then hit ok again.
OK to go back to the script.
Currently we are in debugger mode so we need to hit this red square button to exit the debugger mode.
Now I can hit control are twice to run the script.
You can see that the result is showing.
Even though I did not hit the Green Triangle button.
Feel free to change the shortcut key to whatever key that works best for you.
OK finally we've completed setting up the environment.
Now let's go onto the next lesson and start programming the drones.