Python Tutorial for Beginners 1: Install and Setup for Mac and Windows
Skills:
LLM Foundations60%
Key Takeaways
This video tutorial covers the installation and setup of Python 3.6 on Mac and Windows, including using the terminal, interactive prompt, and creating and running the first script. It also introduces popular text editors and IDEs for Python development.
Full Transcript
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 um how to work with conditionals and loops and iterations how to create functions um 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 de 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 timestamp where we start the installation for Windows and that way you can skip ahead if you want um or if you already have python installed for your operating system then I'll also put a link to the Tim stamp where 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 to check if python is pre- installed then we can just open up our terminal and within our terminal we can say python D- version now we can see here that the default python is python 27 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 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 we 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 uh you can change the install location if you want I'm just going to leave that as the default and you may need to put in your password to install this now once that's finished installing it will place a python 36 directory in your applications folder and if we open up our applications folder and scroll down here a bit then you can see I have an old version of python 35 here but it installed this python 36 and if we open this up and look inside here then 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 36 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 27 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 then we can see that we get python 36 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 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 a 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 Tilda means your home directory and then a slash now this file is called bashore 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 uh 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 installed 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 uh to the bottom and add an alias now to do this all we have to do is say Alias uh 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 control X to close hit Y uh that to say that we want to save it and then hit enter to keep that same file name 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 D- version and now we can see that it's using python 36 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 then you can click on the Tim stamp in the description below that skips forward to when both of these installations are complete but this install for Windows actually doesn't take very long at all okay 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 D- version and most likely you'll see that this is not yet installed and get this python is not recognized error so to install this we can just open up an internet browser and go to the python website which is python.org 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 go want to go with Python 3 unless you have a really good reason to do otherwise so let's go ahead and go with uh this download 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 36 to your path this will allow us to uh 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 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 uh 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 36 so that's good now if we come down here and click on start and all programs then we'll see that we have this python 36 folder here that was installed with python within this folder we can see that we have a program called uh 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 36 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 uh python is going to to work the same for both operating systems so everyone is going to be able to follow along okay so now I'm just going to go ahead and minimize that okay so now that we have python installed uh 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 okay so now within the terminal or command prompt if we just type in Python then this will open What's called an interactive prompt and we we can see that it shows that we're using python uh 36 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 uh equal to 10 and if I print out X then we can see that we get 10 now this interactive prompt is okay for test 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 close 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 36 folder that we opened up earlier and on the Mac it's just down here in 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 uh 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 parentheses 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 dopy 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 you saved it to your desktop then that should be in desktop and then the name of that file is intro. piy so if we run that then 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 in 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 uh 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 it still just prints out hello world so when we actually run our python programs these comments are ignored uh 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 emac if you'd like uh some of the most popular editors and I have some of these pulled up in the browser here so one very popular editor is sublim text and that's at sublim text.com another popular text editor is Adam and that's at adam. iio and a very popular IDE is uh the jet brains py charm IDE so Sublime Text and adom are text editors uh but with a lot of extra functionality built in and pycharm is a full-blown IDE and that will give you a lot of extra features that you might not find in 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 Ed 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. piy 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 then we get the same hello world output that we got when we ran 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 walked 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 how saw how to create a python file and execute that script so in the next video we'll start learning about variables and data types and specifically we're going to look at the string data type 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 to support them then there are several ways you can do that the easiest way is 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
Original Description
In this Python Beginner Tutorial, we will start with the basics of how to install and setup Python for Mac and Windows. We will also take a look at the interactive prompt, as well as creating and running our first script. Let's get started.
Mac Install: 1:25
Windows Install: 5:44
Installs Complete: 8:37
Watch the full Python Beginner Series here:
https://www.youtube.com/playlist?list=PL-osiE80TeTskrapNbzXhwoFUiLCjGgY7
Sublime Text Setup Video: https://youtu.be/xFciV6Ew5r4
Atom Setup Video: https://youtu.be/DjEuROpsvp4
✅ Support My Channel Through Patreon:
https://www.patreon.com/coreyms
✅ Become a Channel Member:
https://www.youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join
✅ One-Time Contribution Through PayPal:
https://goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
http://a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
https://www.amazon.com/shop/coreyschafer
▶️ You Can Find Me On:
My Website - http://coreyms.com/
My Second Channel - https://www.youtube.com/c/coreymschafer
Facebook - https://www.facebook.com/CoreyMSchafer
Twitter - https://twitter.com/CoreyMSchafer
Instagram - https://www.instagram.com/coreymschafer/
#Python
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Corey Schafer · Corey Schafer · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Web fonts using CSS Font Face
Corey Schafer
Using Font Awesome in Desktop Applications (OS X)
Corey Schafer
Sublime Text 2: Setup, Package Control, and Settings
Corey Schafer
ArcGIS API for JavaScript Part 1: Our First Web Map
Corey Schafer
Mac Tip: Windows' Snapping Feature on Mac with HyperDock
Corey Schafer
Linux/Mac Terminal Tutorial: Creating Aliases for Commands
Corey Schafer
ArcGIS API for JavaScript Part 2: Starting Templates
Corey Schafer
Paver Patio Time Lapse
Corey Schafer
Mac Tip: Ways to perform Screen Capturing and Screenshots
Corey Schafer
WordPress Plugins: Imsanity
Corey Schafer
WordPress Tips: Test your theme with Theme Unit Test and Monster Widget
Corey Schafer
Sublime Text 3: Setup, Package Control, and Settings
Corey Schafer
Understanding Binary, Hexadecimal, Decimal (Base-10), and more
Corey Schafer
Mac Tip: Adding Folder Stacks to the Dock
Corey Schafer
CSS Tips and Tricks: Add External URLs to Print Stylesheets
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 7 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 1 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 5 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 4 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 3 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 2 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 6 of 7)
Corey Schafer
Python Tutorial: if __name__ == '__main__'
Corey Schafer
Sublime Text Quick Tip: "Go To Definition" Click Shortcut
Corey Schafer
How to quickly create favicons for the desktop, Apple/Android devices, tablets, and more
Corey Schafer
Easily Resize Multiple Images Using Picasa
Corey Schafer
Easily Resize Multiple Images Using the Mac Terminal
Corey Schafer
Python Tutorial: virtualenv and why you should use virtual environments
Corey Schafer
Python Tutorial: pip - An in-depth look at the package management system
Corey Schafer
Git Tutorial: Using the Stash Command
Corey Schafer
How Software Engineers, Developers, and Designers can volunteer their skills
Corey Schafer
Git Tutorial: Diff and Merge Tools
Corey Schafer
Git Tutorial: Change DiffMerge Font-Size on Mac OSX
Corey Schafer
Sublime Text Quick Tip: Launch Sublime Text from the Terminal
Corey Schafer
Python Tutorial: str() vs repr()
Corey Schafer
Programming Terms: DRY (Don't Repeat Yourself)
Corey Schafer
Programming Terms: String Interpolation
Corey Schafer
Programming Terms: Idempotence
Corey Schafer
Python Tutorial: Namedtuple - When and why should you use namedtuples?
Corey Schafer
Programming Terms: Mutable vs Immutable
Corey Schafer
Python Tutorial: Else Clauses on Loops
Corey Schafer
Overview of Online Learning Resources
Corey Schafer
Mac OS X Terminal Tutorial: Time-Saving Keyboard Shortcuts
Corey Schafer
Git Tutorial for Beginners: Command-Line Fundamentals
Corey Schafer
Quickest and Easiest Way to Run a Local Web-Server
Corey Schafer
Python Tutorial: Generators - How to use them and the benefits you receive
Corey Schafer
Python Tutorial: Comprehensions - How they work and why you should be using them
Corey Schafer
Chrome Quick Tip: Quickly Bookmark Open Tabs for Later Viewing
Corey Schafer
Programming Terms: Combinations and Permutations
Corey Schafer
Git Tutorial: Difference between "add -A", "add -u", "add .", and "add *"
Corey Schafer
Preparing for a Python Interview: 10 Things You Should Know
Corey Schafer
SQL Tutorial for Beginners 1: Installing PostgreSQL and Creating Your First Database
Corey Schafer
SQL Tutorial for Beginners 2: Creating Your First Table
Corey Schafer
SQL Tutorial for Beginners 3: INSERT - Adding Records to Your Database
Corey Schafer
Linux/Mac Terminal Tutorial: Navigating your Filesystem
Corey Schafer
Python: Ex Machina Easter Egg - Hidden Message within the Code
Corey Schafer
Mac Tip: New Split Screen Feature in El Capitan
Corey Schafer
Setting up a Python Development Environment in Eclipse
Corey Schafer
Git Tutorial: Fixing Common Mistakes and Undoing Bad Commits
Corey Schafer
SQL Tutorial for Beginners 4: SELECT - Retrieving Records from Your Database
Corey Schafer
More on: LLM Foundations
View skill →
🎓
Tutor Explanation
DeepCamp AI