Python Tutorial for Beginners 1: Install and Setup for Mac and Windows
Video Title: Python Tutorial for Beginners 1: Install and Setup for Mac and Windows
Hey there how’s it going everybody in this series of videos we’ll be going over the basics of Python programming now I get a lot of messages from people who say that they enjoy my Python videos but that they’re either just getting started out in programming or coming
From another language and would like a beginner’s overview of Python so that they can better understand the more advanced topics and that’s what we’re going to do here we’re going to cover how to get up and running with Python how to work with the different data types how to work with conditionals and
Loops and iterations how to create functions also importing modules and working with the standard library so basically everything that you need to know in order to have a firm understanding of the Python fundamentals now one thing I do want to point out is that throughout these tutorials I’m
Going to go over a few topics that I’ve already made eat more detailed videos about and anytime that happens I’ll touch on the basics of that topic but then reference the more detailed video if you’d like to see more examples and that will allow us to move along at a
Good pace so let’s go ahead and get started so first we’re going to learn how to install Python and set up our development environment and we’re going to look at how to do this on both Mac and Windows and this is pretty straightforward process
So first we’ll look at how to do this on a Mac but if you’re on a Windows machine then you can look in the description section below and I’ll put a link to the time stamp where we start the installation for Windows and that way
You can skip ahead if you want or if you already have Python installed for your operating system and I also put a link to the time stamp or both of these installations are complete so that you can skip to where we’re ready to write some code so for a Mac Python usually
Comes pre-installed the check if Python is pre-installed then we can just open up our terminal and within our terminal we can say Python – – version now we can see here that the default Python is Python – 7 now it used to be more controversial as to which version you
Want to use but almost everyone is moving over to Python 3 and if you’re learning Python then you’re definitely going to want to go with Python 3 unless you have a really good reason to do otherwise so let’s go ahead and install the latest version of Python 3 so to do
This we’re just going to pull up an internet browser and we’re going to go to the Python website which is here at python.org and from here we can go to downloads and we can see that it already detected that we’re on a Mac and has offered up either python 3 or python 2
And you want to go with the latest version Python 3.6 so that’s going to download a pkg file and we will click on this to go ahead and start the installation now this is a pretty standard walkthrough here if you’ve installed software before then all a lot of this will look
Familiar so we’re just going to agree to some terms you can change the install location if you want I’m just going to leave that as default and you may need to put in your password to install this now once that’s finished installing it will place a Python 3:6 directory in
Your Applications folder and if we open up our Applications folder and scroll down here a bit and you can see I have an old version of Python 3 5 here but it installed this Python 3 6 and if we open this up and look inside here and we can
See that we have this ID or Idol application and we’ll come back to that in just a second so now that we have python 3 6 installed let’s go back to our terminal and check our python version again so if i run that actually let me close down the terminal and open
This back up just so that we’re sure that we’re starting with a fresh slate so now if I run that python version again then most likely you’re going to see that it still says python 2 7 now the reason is because when we installed Python 3 it actually uses this Python 3
Command instead so if I instead use this Python 3 command and check that version and we can see that we get python 3 6 that we just installed now if we want the Python command to use Python 3 then one way we can do this is to create an
Alias now to do this we can add a line to this dot bash profile file and if you don’t know what that is then don’t worry about it too much this is just going to allow us to associate the Python command with python 3 so you can use any editor
To edit this file but since I’m already in the terminal I’m just going to go ahead and use nano and nano is pretty easy for beginners so I will say Nano now this is in your home directory so a tilde means your home directory and then
A slash now this file is called bash underscore profile so now let’s go ahead and open that up now within this file you might realize that I have some more content here than you do and these are just some personal customizations that I have but
Don’t worry about any of this if I go to the bottom here and let me like make this just a little bit larger here now you should see that whenever you install the Python 3 that it actually added a few lines here at the bottom and you
Should have these lines also now setting this path variable like it’s doing here is what allows the Python 3 command to work so we’ll move down here below to the bottom and add an alias not to do this all we have to do is say alias
Python equals Python 3 and you want to make sure it looks exactly like this no space between the equals or anything like that so now to save this we can just hit ctrl X to close hit Y that to say that we want to save it and then hit
Enter to keep that same filename so now if we quit out of our terminal and open this back up and now let’s check that python version again so I’m going to do Python – – version and now we can see that it’s using Python 3 6 now I probably should have mentioned this
Earlier but you do not have to create that Python alias if you wanted to you could just use that Python 3 command to run all of your scripts but I like to use this Python command so that’s why I personally like to create the alias okay
So now let’s walk through how we install Python 3 for Windows now if you’re on a Mac and want to skip through this part and you can click on the timestamp in the description below that skips forward when both of these installations are complete but this install for Windows
Actually doesn’t take very long at all ok so to check if python is already installed we can open up our command prompt by going down here to start and then search for CMD and let’s open up that and I’m going to make this font a little bit bigger so that we can see
Here I think I can click on properties and font and we’ll go with something a little bit larger there okay now to see if we have access to Python we can just type in Python – – version and most likely you’ll see that this is not yet
Installed and get this Python is not recognized err so to install this we can just open up an internet browser and go to the Python web site which is Python dot and from here we can click on downloads and from this page you can see that it’s
Already detected that we are on Windows and has offered up either Python 3 or python 2 now if you’re learning Python then you’re definitely going to want to go with Python 3 unless you have a really good reason to do otherwise so let’s go ahead and go with this download
Of python 3.6 so let’s go ahead and run this download and we should get this pop-up so i’m going to go ahead and run that now this is an important step here one thing that you’re going to want to do is click this option to add python 3
6 to your path this will allow us to get by without going into the advanced system settings and setting this path manually and adding that to your path will allow the Python command to work within the command prompt so with that selected now let’s go ahead and just
Click through this installation and it says that setup was successful so now that python is installed let’s come down here to our command prompt and open it back up actually let’s close this one down and start from scratch so we’ll open this back up type in CMD and open
Up that command prompt again and now we can make sure that that installed by typing in Python and then – – version you can see here that it says that we’re working with Python 3 6 so that’s good now if we come down here and click on
Start and all programs and we’ll see that we have this Python 3 6 folder here that was installed with python within this folder we can see that we have a program called idle and I’m going to come back to this idle program in just a second so when I mention this program
Then just remember that you can find it here within this Python 3 6 folder so that is how we install Python for Windows now I’m going to switch back to my native operating system on the Mac but from this point on python is going to work the same for both operating
Systems so everyone is going to be able to follow along ok so now I’m just going to go ahead and minimize that ok so now that we have Python installed now we can begin and go ahead and write our first bit of code by opening up either our
Terminal or our command prompt and I’ll just close this installation window down in the back here and Center this ok so now within the terminal or command prompt if just type in Python and this will open what’s called an interactive prompt and we can see that it shows that we’re
Using Python 3 6 now the interactive prompt allows us to write one line of Python at a time so for example for a hello world application then we could simply write print hello world and we can see that it prints that out and we can also set
Variables so I could say X is equal to equal to 10 and if I print out X then we can see that we get 10 now this interactive prompt is OK for testing Python commands but we really want to have a Python file where we can write
Multiple lines and run an entire script so let’s exit this interactive prompt and we can do that by typing exit and then opening closed parenthesis so to create a Python file we’re going to need some kind of plain text editor when we downloaded Python it came with an editor
Called idle so let’s open up that idle program so again on windows that’s in the Python 3 6 folder that we opened up earlier and on the Mac it’s just down here and our applications and we can go ahead and open this up so I’m going to
Go ahead and make the font a little bit bigger here by going to my preferences just so that everyone can see and I’ll bump this up to 18 or so okay I think that’s good now by default when we open up idle this is just another interactive
Prompt where we can write one line at a time and you can usually tell when you’re at an interactive prompt because of these three arrows here so to create an actual file we can click on file and new file now this will create a new file where we can write multiple lines of
Python and actually make a script so for our first script let’s just print out hello world like we did before we can do that by calling the print function and then these opening and closing parenthesis and then either single or double quotes and then typing in hello
World now we’re going to want to save this file so we can save this by clicking on file and then save and I’m going to call this intro dot pi and I’m just going to save this to my desktop so now I’ll go ahead and save that so now
To run the python file that we just created we can go back to our terminal or our command prompt and from here we can type in Python and then we want to type in the name of the file that we want to run now this is relative to the
Directory that we’re currently in so if we’re in our home folder and when you saved it to your desktop then that should be in desktop and then the name of that file is intro dot pi so if we run that and you can see that it printed
Out hello world so we just ran our first Python program now I still have this Python file up over here and real quick let me show you how to do a single inline comment and Python because I’ll be using these inline comments throughout these tutorials and don’t
Want them to throw you off so in my script here if I wanted to write a description of what’s going on then I could add a comment and to do this we can just start up here at the top line and I’m going to go ahead and write a
Comment of what we’re doing so what it starts with the pound sign and then our comment so I’ll just say print a welcome message now if I go ahead and save that file and then run this again from my desktop then you can see that it didn’t
Do anything to our script that still just prints out hello world so when we actually run our Python programs these comments are ignored it’s only there for the developer and the programmer to actually see what’s going on now you don’t need anything fancy to run these
Python scripts so if you wanted to then you could follow through all of my videos using this idle application like we have running here and then running the script from the command line but if you plan on doing a lot of Python programming then you’ll likely want to
Upgrade to a better editor now you can use any kind of plain text text editor that you want you can even use some command line editors like vim or Emacs if you’d like some of the most popular editors and I have some of these pulled up and the browser here so one very
Popular editor is sublime text and that’s at sublime text calm another popular text editor is atom and that’s at atom IO and a very popular IDE is the JetBrains pycharm ide so sublime text and atom are text editors but with a lot of extra functionality built in and PyCharm is a full
Loan ide and that will give you a lot of extra features that you might not find and other editors like the ability to debug a running application and things like that now in this series of videos i’m going to be using sublime text now i
Have a full video on how i set up and customize my sublime text and i also have a full video on how to set up and customize atom so if you want to use either of those editors and i highly recommend watching those videos and i’ll leave links to those in the description
Section below now one nice thing about using one of these editors is that you can run Python from directly within the editor so I have the same intro PI file that we just created pulled up here in sublime text and I can run this by going
To tools and build or we could have just used that keyboard shortcut but you can see that if we run that and we get the same hello world output that we got when we ran at this file from our command line so to follow along with these
Videos you can use the idle application and use the command line to run those scripts or you can set up one of these other text editors the choice is completely up to you okay so I think that is going to do it for this video in this video we walk through how to
Install Python on both Mac and Windows we looked at how to run Python interactively within the terminal or command line and we also have saw how to create a Python file and execute that script so in the next video we’ll start learning about variables and datatypes and specifically we’re going to look at
The string datatype and everything that we can do with those but if anyone has any questions about what we covered in this video then feel free to ask in the comment section below and I’ll do my best to answer those now if you enjoy these tutorials and would like to
Support them there are several ways you can do that the easiest ways to simply like the video and give it a thumbs up and also it’s a huge help to share these videos with anyone who you think would find them useful and if you have the means you can contribute through patreon
And there’s a link to that page in the description section below be sure to subscribe for future videos and thank you all for watching worried you
-
Sale!
Wireless WIFI Repeater Extender Amplifier Booster 300Mbps
$29.99$14.99 Add to cartWireless WIFI Repeater Extender Amplifier Booster 300Mbps
Categories: Electronics, Wi-Fi Router, Wireless Wi-Fi Extender Tags: 300Mbps, 802.11N, Amplifier, Booster, Extender, mobile wi-fi booster, Remote, WIFI, Wireless, Wireless WIFI, Wireless WIFI Repeater, Wireless WIFI Repeater Extender, Wireless WIFI Repeater Extender Amplifier, Wireless WIFI Repeater Extender Amplifier Booster, Wireless WIFI Repeater Extender Amplifier Booster 300Mbps$29.99$14.99 -
Sale!
Full RGB Light Design Gaming Headset Headphones with Mic
$24.99$14.99 Add to cartFull RGB Light Design Gaming Headset Headphones with Mic
Categories: Electronics, Gaming, Gaming Headsets Tags: Design, Full, Full RGB Light Design Gaming Headset, Full RGB Light Design Gaming Headset Headphones, Full RGB Light Design Gaming Headset Headphones with Mic, Gamer, Gaming, Gaming Headset Headphones, gaming headset wireless, Headphone, Headphones, Headset, Light, Mic, Package, RGB$24.99$14.99 -
Sale!
Wireless BlueTooth Multi-Device Keyboard Mouse Combo
$39.99$19.99 Add to cartWireless BlueTooth Multi-Device Keyboard Mouse Combo
Categories: Electronics, Gaming, Gaming Keyboards, Keyboard Mouse Combos Tags: Combo, Keyboard, keyboard mouse combos, Mouse, MultiDevice, Set, WireKeyboard Mouse Combo, Wireless, Wireless BlueTooth Keyboard Mouse Combo, Wireless BlueTooth Keyboard Mouse Combos, Wireless BlueTooth Multi-Device Keyboard Mouse Combo, Wireless BlueTooth Multi-Device Keyboard Mouse Combos$39.99$19.99 -
Sale!
High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
$199.99$139.99 Add to cartHigh Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
Categories: Gaming, Gaming Chairs Tags: Adjustable, Chair, computer chairs, Desk, Executive, Gaming, Girl, Headrest, High, High Back Leather Executive Adjustable Swivel Gaming Chair, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar, High Back Leather Executive Adjustable Swivel Gaming Chairs, Leather, Lumbar, Office, Racing, Swivel$199.99$139.99 -
Sale!
Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
$29.99$19.99 Select optionsProfessional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
SKU: N/A Categories: Electronics, Gaming, Gaming Headsets Tags: Cancelling, Gaming, Gaming Headphones with Noise Cancelling Microphone, gaming headset, Headphones, Headset, LED, Light, Mic, Microphone, Noise, Professional, Professional LED Light Wired Gaming Headphones, Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone, Wired, Wired Gaming Headphones, Wired Gaming Headphones with Noise Cancelling Microphone$29.99$19.99 -
Sale!
Gaming Desk with LED Lights USB Power Outlets and Charging Ports
$349.99$249.99 Select optionsGaming Desk with LED Lights USB Power Outlets and Charging Ports
SKU: N/A Categories: Computer Desk, Gaming, Gaming Desk Tags: and Charging Ports, Charging, Desk, Desks, Gaming, gaming desk with led lights, Gaming Desks with LED Lights, Home, LED, Lights, Monitor, Office, Outlets, Port, Power, Room, Stand, USB, USB Power Outlets, White, Workstation$349.99$249.99 -
Sale!
Wired Mixed Backlit Anti-Ghosting Gaming Keyboard
$99.99$79.99 Add to cartWired Mixed Backlit Anti-Ghosting Gaming Keyboard
Categories: Electronics, Gaming, Gaming Keyboards Tags: Antighosting, Backlit, Blue, brown, Gaming, Gaming Keyboard, gaming keyboards, gaming keyboards and mouse, Keyboard, Laptop, Switch, Wired, Wired Mixed Backlit Anti-Ghosting Gaming Keyboard, Wired Mixed Backlit Anti-Ghosting Gaming Keyboards, Wired Mixed Backlit Gaming Keyboard$99.99$79.99 -
Sale!
Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
$119.99$59.99 Add to cartWireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
Categories: Electronics, Gaming, Gaming Headsets Tags: 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, ANC, Audio, Bluetooth, Cancellation, Ear, Earphone, gaming headset, Headphones, Headset, Hi-Res Over the Ear Headphones Headset, HiRes, Noise, Wireless, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Headphones, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headsets$119.99$59.99 -
Sale!
Wired Sports Gaming Headset Earbuds with Microphone
$19.99$9.99 Select optionsWired Sports Gaming Headset Earbuds with Microphone
SKU: N/A Categories: Gaming, Gaming Headsets Tags: Accessories, Earbud, Earphone, Earphones, Gaming, gaming headset with microphone, Headphones, Headset, IOS, Microphone, Sports, Wired, Wired Sports Gaming Headset Earbuds, Wired Sports Gaming Headset Earbuds with Microphone, Wired Sports Headset Earbuds$19.99$9.99 -
Sale!
150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
$49.99$29.99 Add to cart150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
Categories: Charging Stations, Electronics Tags: 150W, 150W Charging Station, 150W Universal Multi USB Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Stations, 150W Universal Multi USB MAX Charging Station, 16 Port MAX Charging Station, 3.5A, Charger, Charging, Fast, laptop charging stations, Max, Multi, Port, Stand, Station, Universal, USB$49.99$29.99
This is a good channel on Python. I saw one excellent channel TechieTalkee which has a good list of training videos on Python concepts providing a very clear and easy understanding with excellent examples. Persons desirous of learning Python clearly can view the videos.
Many thanks, sir.
1. What if I'm using the VS Code text editor? Problem?
An AI recommend this video and I confirm that it is good
10/10 tutorials….god bless you
Why when I do that by step, when i get to the desktop/intro.py, my Python says invalid Syntax, to the word Desktop ?
I am using windows and python 3.12, when trying to call "python Desktop/intro.py" it is giving me error "File "<stdin>", line 1 .. Please help
This was insanely helpful. Thank you so much!
What about visual studio code as the text editor
I need a partner for this journey
🎉Have any new other vidoes just for addiotuinal knowledge…..to make ti be as prorammer…..and i hope it have more fascinating lectures you've discuss .Just for all beginners ,means amateur for these planned ti be….sooon ….be might to be like one just liked to be you,usuallyvthank for your videos and i'm interested to learn to it.
I have 0 knowledge about it can i start from this playlist?
"hello world" is not printing in my cmd even though i've put in the correct file location. it just says syntax error
My welcome message wasn't executed it's showing can't open file [Error2]
I think this is a scam 😢
its still relevant for learn now?
Hi Corey …is this upto date in 2023 ?
I generally have to put every video on a 2x speed to utilize time. But with this video, it wasn't the case. It was crisp, to the point and every second was important. Thanks for valuing our time and of course, the knowledge you imparted.
Wow this is incredibly UN-helpful for PC users. We follow your directions and it doesn't work. Ill find a better teacher elsewhere.
Sir I completed my degree graduation am I eligible for soft ware job ?
I got fatal error during installation what can i do 🙂
Python does NOT come pre installed on MAC anymore.