Windows 10- Installing Python and Writing A Program
Hello and welcome to my video that shows how to get started and install Python on Microsoft Windows. I like writing the command line because you, it's, after awhile it's important to know what folder things are being run in. And so I- I hope that this little introduction about getting things started and writing your first Python program has been helpful to you.
- زمان مطالعه 8 دقیقه
- سطح سخت
دانلود اپلیکیشن «زوم»
این درس را میتوانید به بهترین شکل و با امکانات عالی در اپلیکیشن «زوم» بخوانید
متن انگلیسی درس
Hello and welcome to my video that shows how to get started and install Python on Microsoft Windows. Okay? So, it’s not too hard. We’re going to both install Python 3 and we’re going to install Text Editor. And so, I’m just going to go into Google and then I install Python 3. And my top link is downloading Python, and there is my link for downloading Python 3.5.2. This version of my class uses Python 3. I have an earlier class that you may have seen that uses Python 2 but in this class we’re going to do this. Now, it might take you a while to download this. I’ve actually already downloaded it. Now, the other thing we need is a program or text editor and you can really use any program or text editor. We know – we’ve used Notepad Plus in the past. We’ve use, jEdit in the past. I like atom, atom.io, T-O-M.io, mostly because it works the same on Windows and Mac and Linux. But you can really use any text editor that you like, just don’t use Word or, Text Edit that comes with the operating system. You need a programming editor that doesn’t mess with weird characters or weird lines or strange formats. You must have a real programmer editor and some have down –, I’ve already downloaded this as well. And so, I won’t waste the time waiting to download it but let’s go ahead and do the installation. So, these things – these things ended up in my, my downloads file, so I’ll go to downloads and I’ll start installing Python 3.5.2. Now, it’s going to ask me some things, add Python 3.5 to the path and that’s a good idea. Install the launcher for all users. I’m going to add that. Maybe you will, maybe you won’t do that. It’s going to tell me where it’s going to install it. Install now. Of course, it’s going to ask me for permission to do these things. And now it’s running through the installation. Okay. So there we go. You could maybe click on this online tutorial on documentation. But we’re just going to close this and I’m going to start and run the Windows command line. Now, you may have all kinds of fancy ways to run Python but I like running the command line, C-O-M-M-A-N-D. I like writing the command line because you, it’s, after awhile it’s important to know what folder things are being run in. And so here’s this command line and I should be able to type Python here. And so now, I’m in Python 3.2 and this is the Chevron prompt. Here is the python interpreter where it’s asking for Python commands. And I can say print ‘hello, world’. Of course, this is what we tend to print all the time. I can make a mistake. I can say blu-blu-blu. Right? And it will complain to me. Now, to get out of this I can either type control Z or quit. In this case, I’m gonna type control Z and I’m back to the prompt. Couple of things – I can do a ‘dir” to see what folders and files I have and that is like my desktop. And then the cd command tells me where I’m at in the folder. That means, I’m in the user’s directory, drchu. Okay? So, I have now installed Python. I ran the Python interpreter to verify it. I said print ‘hello world’. Okay. And so, now what I’m going to do is I’m going to actually install atom. I already had this downloaded so let’s go ahead and install atom on my computer. Okay. So atom is now installed and is, kind of, telling us what to do. I’m going to actually just close all these windows, close this window, close everything, and I’m going to create a file. I’m going to say print–. In this case, let’s see if I can make this bigger. I can make it bigger. So, I’m going to type print ‘hello from a file’. Okay. And I’m gonna save this. I’m gonna save ‘file’. Save As. And what I’m going to do is I’m going to go to my desktop and I’m going to make a folder on the desktop and I’m gonna call this folder, PY4E. So, I now have a folder on the desktop. Move this here, I’ll move this here. And, I’m going to go into PY4E and then I’m going to name this file first.py. And you’ll notice that when I save this, when I save this, it, it syntax highlighted it. That’s one of the nice things about a programmer editor. Okay. And so it says, “oh, it’s got a suffix of.py”. So therefore it knows that it’s supposed to look pretty with Python and, make this one color, make this another color. The other thing that you’ll notice is I now have a folder called PY4E and if I am in this command line– let me just start that up again. I’ll show you how to start the command line again. Command. Now, if I do a dir I see the folders that I’m in and one of the folders that you can see here is the desktop folder. So, I’m gonna say CD desktop. And then I’m type the dir command to see what folders are in the desktop. These folders are the same as these folders. These things are kind of virtual folders. PY4E is PY4E. Now, I can type CD which stands for change directory. PY4E. And I can do a dir and now you see first.PY. And that’s the same as if I’m diving into this folder. Here’s this file, first.PY. Windows hides the suffix which is somewhat annoying and frustrating but that suffix is there. That file is there. And so for me, one of the things you’ve got to figure out in Windows is how to make sure that you are in the same folder, users drchu. Desktop py4e. And that’s this name of this file and here as well. And now I’m going to run this program. I’m going to type ‘python first.py’. And you see that it ran the Python code. Okay. Another way you can do this is you can type ‘first.py’ and that’s because this file association has happened in Windows. This doesn’t work in Macintosh. This only works in Windows, that all files with.py are expected to be Python and it knows the Python interpreter where to run. Okay. And so, I’ve got Python 3.0 installed. And that gets me started. And so I– I hope that this little introduction about getting things started and writing your first Python program has been helpful to you.
مشارکت کنندگان در این صفحه
تا کنون فردی در بازسازی این صفحه مشارکت نداشته است.
🖊 شما نیز میتوانید برای مشارکت در ترجمهی این صفحه یا اصلاح متن انگلیسی، به این لینک مراجعه بفرمایید.