Installing Python 3 - How to install/use both Python 2 and Python 3
Key Takeaways
Explains how to install and use Python 3
Full Transcript
All right, everyone. Welcome to my Python 3, specifically Python 33, though it should work with pretty much anything throughout Python 3 uh series. For any of you guys or girls who are new to programming, I will just say that learning to program has been easily one of the best life choices of mine. Definitely in the top three. Uh it's just given me so many options in life and really my freedom to do what I want. So, I do these videos because I hope that I can help other people get to the point uh like that. I really feel like uh at least these days, knowing how to program is a lot like having a superpower. It sounds kind of funny, but it it really is. It gives you the ability to create things pretty much, you know, seemingly from nothing and do it pretty fast. Um, so with especially with things like data analysis and all that as well, it puts you ahead of pretty much everyone else uh that isn't using it because they're using Excel or whatever. Um, I really see it as a superpower. It it definitely falls under the categories of a superpower. So, uh, let me pass on this superpower. So, now for some of you guys, um, you're pro I imagine a lot of people are coming here having never used Python uh, or programming at all. that's not a big deal. This this series, at least the introductory and basics, uh, is geared towards somebody completely new to programming and Python and all of that, but I do expect some Python, especially 2.7 users or other versions of two, sadly, maybe even one. Um, and I also know a lot of people that watch my tutorials do it at the same time as they're taking classes. And many times those classes have you using Python 2, not Python 3. One of my buddies just told me that here in 2014, his class is actually using Python 2.5 since um I guess it's a lot of effort for them to update the coursework. I'm not really sure uh why and I'm doing my best to not uh be so lazy since my channel did also start off as 27 and here I am trying my best to update it to 33. So um while I'm trying to do that, I also realize that people will have indeed reasons to have multiple versions. Uh luckily by this time there are a few nifty ways to handle uh at least using Python 2 and Python 3 together on the same machine. Uh they can even work with each other. Um so I'm going to cover that as well. So both how to like run Python 2.7 and 33 scripts. uh so I can execute them as well as actually edit them in IDLE and work in their specific environments uh in IDLE. So anyways, enough on that. Let's go ahead and get Python 3.3. So to get it, you're going to head to python.org. Uh it's up there uh in the navbar. Hopefully you guys can type that out. Uh then you'll come down here to download and that's what you're going to want to click on here. Now eventually um well I I don't see it here, but if you if you do look at the homepage um Python 3.4 for beta uh one and two are actually already out. So it's conceivable that relatively soon Python 3.4 will um be joining us and if during this series I imagine it might even you know come out in full. So uh if that happens I will just switch to 34. Usually the the differences between Python 3 and 34 especially for a beginner's uh introductory tutorial they won't change anything. So, if by the time you're watching this, you're, you know, they've got a 34, 35, 36, as long as it's Python 3, uh it's highly unlikely that any of these like basic uh introductory topics uh are going to change in the slightest. So, uh go ahead and download the most recent version of three. So, um anyway, so what you're going to want to do is you come down to the downloads here. For me, it's 33. So, you want to download whatever version you have uh by default. But like if you download like let's say this version here uh that's going to download 32-bit. This will download your 64-bit um and and so on. So I I would recommend that you get 64-bit if you uh have a 64-bit operating system. Uh just because 32-bit is limited to 2 GB of memory. Uh so it's useful to be able to pass that sometimes. So anyways, um go ahead and click on whichever one is yours. This one will be mine. And let it go ahead and download. and whenever it's done, uh, we'll install. So, I would suggest you just pause it cuz I'm going to cancel this download cuz I've already downloaded it. Um, so, pause the video until you're done and then we'll continue on with the installation. So, once you've completed the download, I don't know, wherever you saved it, uh, go ahead and open that up and run it. And you can choose what you want to do. I'm just going to install it for all users. You hit next. It's going to ask you where you want to install it. I would just leave it there. Next. next. And wait for it to install and you're all set. So whenever that's done, you can hit finish. Now I will say that at least me, I have two versions, right? I've got both Python 2.7 and 33 running on my machine. And actually I have scripts uh that must run um 27 like they're written in 27 and I just have not ported them to 33 yet. So I want them to continue uh being able to run. So the question is how do you do something like that? So the first thing I'll show you guys is the most basic and that's going to be what you need to put at the top of the script uh to make sure they execute. And this is only for when you install in the order of Python uh 2 and then after that you installed Python 3 on top of Python 2. Uh as far as I know, someone can can let me know. But in order to go from Python, let's say you installed Python 3 and then you later decide to install Python 2, it's actually really hard to get Python 3 to run. I've you can get it in kind of a finicky way and I think you can just change like registry keys or something. Um, but for the for the purposes here, um, I've installed Python 2 first, then Python 3, and that seems to be the best way to go about having both installed on your machine. So, anyways, let's continue on. Um, and I'll show you guys now how to uh run both versions. So, what I've gone ahead and done is I've got two scripts here. Uh, let me just pull this over here. Now, uh, what I've got here is I've got run 27 and run 33. And so, uh, let me go ahead and edit a couple of these. So, this one, couple of these, both of them. Um, I'll just edit them both at the same time. Multitasking. So, as you can see at the top of the script, um, if you're familiar with, uh, programming, this is like your shebang line, right? So generally if you're on something like it's not really too necessary if you're on Windows but if you're on something like uh Linux and you want to be able to execute Python from the command line without actually saying um you know Python in front of it uh so if you're like running a cron or something like that what you would do is you would give the path to Python like you know user bin environment Python um but for the purposes here what we're actually going to do is we're telling Python like which version of Python we want to run and this comes comes with Python 3. So this is why if you install Python 3 then Python 2 uh I think it's your environment variable that gets edited and so this actually won't do anything for you if you install in that order but if you install in Python 2 then Python 3 you'll get this uh functionality. So and I'm not positive it comes like so if you if you're running like let's say Python 31 or something uh I'm not positive that functionality is there yet. I I think it came later like after the first version of Python 3. But anyway, moving on. So, what we've got going on here, both scripts are actually identical. Um, they import system import time just so we can see it with enough time. And then you can see all it does is print out the system version. But I will show you guys that if we go, let's say we go F5 to run, uh, we're actually running in 33 because IDLE wants to default to 33 since that's the last one we downloaded. Um, and changing that is possible and I will show you guys how uh in a minute, but first I want to show you this. Um, so it's still going to run in 33. And just for anyone that's curious, um, this print like functionality, you can do this in Python 2.7. Uh so even though this did run indeed in in 33, you're able to do this like the add the parenthesis like this uh in 27. So just just for anybody that's like well that's the 33 way of doing it. Anyway, uh they're identical and all they're going to do is just print the version of Python. So what I'm going to go ahead and do now is close them both. And the only difference between these two scripts is just what we call up here. And this one just says, "Hey, I want to run in Python 2." This one says, "Hey, I want to run in Python 3." And actually, this is not necessary since we downloaded Python 3 last. Uh I believe the default will be Python 3, but now that I think about it, I'm not positive on that. But anyways, um in fact, let's just run another one. I'm pretty sure it's Python 3, but now I can't remember. U just run I'll edit this one and just not have that. Okay. So, uh let's go ahead and we'll run this first one. Okay. Yeah. So, so the default um is actually 27 if you have both installed. Interesting. Um so then it only makes sense that this 27 is going to run 27. Let's hope so. That would be really bad. So again, we run this one, it is indeed running 27. And if I ran this one, it is indeed running 33. So that's how you would do that. Now, I imagine some of you guys are like, how did you even get here? Like how did you even get to make these scripts and all that stuff, right? So So let's talk about that. let's say like how do we actually do stuff like this, but I did just want to at least show some people right off the bat how you can handle having both versions. So really in your old versions, you don't even really need to put anything at the top because it's going to default. But just in case they ever change that in the future, you might as well just keep it up there. So now um what about all the the uh poor folk who have never used Python before? So once you've installed Python, uh you should be able to at least go, you know, to your directory and go to, you know, Python. If you're on Windows, you should be able to go to your start bar. Really any machine you should be able to go to your start bar and then you go, you know, all programs. And at least for me, uh mine's going to like I've see Python 2.7 and 33 here. So since we used Python 33, you should click on that. And in fact, let me bring my uh window down here. So here it is. um 33 and then here you have idle module docs python command line uninstall and manuals. Um, so the command line when you click on that, that's going to bring up kind of like a live interpreter for you. And so what you can do is you can do stuff like this, like print uh hi, right? That's going to print out hi for you. Um, and you can code straight into here, but I don't actually like doing it because it is uh it is live and so it's a little tedious uh to use it because uh it it's going to work your program step by step. Now in some senses like for debugging purposes that could be useful but also there's no easy way to save this. So really only for like really short tests and stuff like that would I recommend using this. But the next thing we'll come over to 33 and idle is what we want. So there's actually a lot of what's called idees which is uh your and at least with with Python they call it idle. Doesn't really matter. It is an IDE. It's just interactive development environment or it's like in I think maybe it's integrated doesn't really matter but it stands for the same thing as every other IDE stands for. Python just added an L there. It's just for development I'm pretty sure. Anyway, so click on that and that should bring up this bad boy here. And as you can see this says Python 33. So uh let me drag this window over now. So again if if you wanted to So I showed you guys how to actually like run the script. um in whatever version you want. But check this out. If I rightclick here, like generally once you've installed Python, you should have an edit with IDLE. If we click on that, even though it's Python 2.7, right? That's the one we've wanted. But if we click on that and hit uh run module, it's actually, as you can see at the top here, 33, and it sure enough ran in 33. So that's kind of annoying if you still want to develop in Python 2.7. So the same way that we've opened up the uh the idle in Python 3.3, you can go here all Python 27 idle and that'll bring up idle for you. Let me just bring this back over again though. And what you can do now is you can see this is 27. And at the same time when you go to open you can go file open and we come over here and let's say I want to open this one. We've opened that up now. And when I go to run, you could even close this if you wanted to, or at least you should be able to. Let's find out. Yeah. So, we opened it in 27. And so, as you can see, now we're actually running in 27. And you can do your edits in 27. So, that's how you can get around it because natively, if you edit with with IDLE now, it's going to be in 33. But anyway, so I'm going to close out of this. And so so whenever you have a script like you bring up idle the first time like if you don't have any Python files you won't really have anything uh to make. But if you know don't have any Python files you would open up idle and then go file new file uh and you have this like untitled document. And so for now what I'll just say is like you we'll we'll make it do something. And so we'll just put a print in here and it's just going to print a space. And then what you want to do is you go file, save as, and then we'll bring it over here. And then for now, I'll just say we we'll call this TUT. And interestingly enough, it looks like it saves it aspit document in Python. It won't save it as pi. It'll save it as like I think it's text and or maybe even like no extension. I don't even know. It It's just really annoying. So, I'm actually now I'm curious because normally like you save it and it saves it as all files and it's really annoying. So, I'm going to hit save. Uh, let's find out. Yes. Nice. Well, in 27, so if you are brand new to Python and some teacher is making you use 27 or 25 when you go to save uh originally, you must add the py at the end. Otherwise, it's going to save it as like a blank text or like a regular text file, and that's kind of annoying. So, I see they fixed that in Python 3. So, that's great. So very long installation and you know how to run all the various versions if you want to. Um but there are there's definitely a ton of questions online about like how to get that how to get both running at the same time. And generally if you're going to do Python right at least at the moment there's going to be times where you might need Python 2.7. Uh so that's how you can do it. That's how you can get yourself all set up and now you're ready to learn to program. So, uh, anyways, that's going to conclude the installation and, you know, initial setting up of everything. As always, thanks for watching. Thanks for all the support and the subscriptions. And until next
Original Description
Sample code for this basics series: http://pythonprogramming.net/beginner-python-programming-tutorials/
Python 3 Programming tutorial Playlist: http://www.youtube.com/watch?v=oVp1vrfL_w4&feature=share&list=PLQVvvaa0QuDe8XSftW-RAxdo6OmaeL85M
Everyone starts as a beginner. Hopefully I can help many of you out of that stage! Many people know they want to learn to program, but they are not sure which language to go with or where to start. Python is often chosen by beginners due to its "high level" nature. "High level" might make it sound like it is more complex or something, though it means the opposite. Python's syntax and other structuring is very simplistic and easy for even a beginner to follow. Many people find that they can actually read and understand what is going on with non-obfuscated Python code, even if they have no knowledge of Python or programming.
Python is certainly one of the top languages for its use, and has been referred to as the "second best language for anything." You can use Python for web development, data analysis, robotics, games, AI, and a whole lot more.
If you're looking to acquire the superpower of programming, I am here to help! If you stick around here enough, you'll find out that I like to belittle problems. Every major problem or goal can be broken down into parts. Learning to program is a massive undertaking. It can be extremely daunting for someone who is new to it. Luckily, the task of learning how to program can be broken down as well. Most programs are just combinations of a small handful of tools and operations built together to do awesome things. This is usually some if-statements in a few functions with a few loops and, boom, program! Let's take those baby steps.
In this tutorial, you are shown how to install Python 3, as well as how to maintain installations of both Python 2 and Python 3. When I was making this video, Python 3.4 beta was out, so the most current version might be 3.4. Downloading that will be fine and the
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from sentdex · sentdex · 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
Matplotlib Python Tutorial Part 1: Basics and your first Graph!
sentdex
Python Encryption Tutorial with PyCrypto
sentdex
Python's Logging Function
sentdex
wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
sentdex
wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
sentdex
wxPython Programming Tutorial 3: Menu Bar and Menu Button
sentdex
wxPython Programming Tutorial 4: Panels
sentdex
wxPython Programming Tutorial 5: User Input Saved To Variables
sentdex
wxPython Programming Tutorial 6: Multiple Choice Input
sentdex
wxPython Programming Tutorial 7: Adding Static Text and Colors
sentdex
wxPython Programming Tutorial 8: Custom Button Images
sentdex
wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
sentdex
Basic PHP Tutorial 13: Multi-dimensional Array
sentdex
Basic PHP Tutorial 15: Functions and Global Variables
sentdex
Basic PHP Tutorial 12: Associative Array
sentdex
Basic PHP Tutorial 14: Foreach loop
sentdex
Basic PHP Tutorial 16: Include and Require
sentdex
Basic PHP Tutorial 7: Assignment, comparison and Logical operators
sentdex
Basic PHP Tutorial 4: Variables and Comments
sentdex
Basic PHP Tutorial 11: Arrays part 1, basic array
sentdex
Basic PHP Tutorial 6: If else and else if conditionals cont'd
sentdex
Basic PHP Tutorial 1: Intro to PHP
sentdex
Basic PHP Tutorial 3: HTML with PHP
sentdex
Basic PHP Tutorial 9: While Loop
sentdex
Basic PHP Tutorial 10: Switch Statement
sentdex
Basic PHP Tutorial 2: Print and Echo
sentdex
Basic PHP Tutorial 5: If else and else if conditional statements
sentdex
Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
sentdex
Basic PHP Tutorial 17: User Input Form Example / String Manipulation
sentdex
Basic PHP Tutorial 18: HTML Entities and forms cont'd
sentdex
Basic PHP Tutorial 19: Finding words in strings
sentdex
Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
sentdex
Basic PHP Programming Tutorial 22: Hashing part 2: salting
sentdex
Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
sentdex
Basic PHP Programming Tutorial 21: MD5 Hashing For Security
sentdex
Basic PHP Programming Tutorial 24: String similarity
sentdex
Basic PHP Programming Tutorial 25: Time and Time stamps
sentdex
Basic PHP Programming Tutorial 26: Die and Exit
sentdex
Basic PHP Programming Tutorial 27: MySQL Databases Part 1
sentdex
Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
sentdex
Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
sentdex
Basic PHP Programming Tutorial 30: MySQL database in Use
sentdex
Django Tutorial Web Development with Python Part 1: Installing Django
sentdex
Python Tutorial: File Deletion and Folder Deletion / directory deletion
sentdex
Python Tutorial: How to Rename Files and Move Files with Python
sentdex
3D Graphs in Matplotlib for Python: Basic 3D Line
sentdex
3D Plotting in Matplotlib for Python: 3D Scatter Plot
sentdex
3D Charts in Matplotlib for Python: Multiple datasets scatter plot
sentdex
Sikuli Tutorial 1: Visually programming in python!
sentdex
Sikuli Tutorial 2: Program visually in python!
sentdex
Sikuli Tutorial 3: Program visually in python!
sentdex
3D Bar Charts in Python and Matplotlib
sentdex
3D Plane wire frame Graph Chart in Python
sentdex
Raspberry Pi Part 1 Introduction
sentdex
Raspberry Pi Part 8: First Download and Update! (Firmware)
sentdex
Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
sentdex
Raspberry Pi Part 11: Remote Desktop
sentdex
Twitter Analysis: How to rank a user's influence
sentdex
GPIO Tutorial for Pi Part 2 - Programming the GPIO
sentdex
GPIO Tutorial for Raspberry Pi Part 1 - Setting up
sentdex
🎓
Tutor Explanation
DeepCamp AI