Macintosh- Using Python and Writing A Program

دوره: Programming for Everybody (Getting Started with Python) / فصل: Installing and Using Python / درس 4

Macintosh- Using Python and Writing A Program

توضیح مختصر

Now you'll notice that it's not syntax highlighting yet, but I'm going to do a File, Save, oopsie daisy. File > Save As, and I'm going to go into my Desktop, and I want to make a folder called py4e. I hope this was helpful to you to get Python 3 installed on your Macintosh.

  • زمان مطالعه 4 دقیقه
  • سطح متوسط

دانلود اپلیکیشن «زوم»

این درس را می‌توانید به بهترین شکل و با امکانات عالی در اپلیکیشن «زوم» بخوانید

دانلود اپلیکیشن «زوم»

فایل ویدیویی

متن انگلیسی درس

In this video we’re actually going to download and install Python 3 from python dot org on a Macintosh. If your Macintosh for years has wonderfully come with Python 2. So if I type python version, then I type that. I see that I only got Python 2.0. What we want to do is in addition install Python 3. One of these days Macintosh might upgrade their distributed version of Python 3, but there’s so many things inside Mac that depend on Python 2. I’m going to expect that it will always be named Python 3, which is what we’re going to call it In a second. So here I am at the Python.org downloads, and I’m going to download Python 3. You click here, and I’ve actually got it sitting here in downloads already, because I always do that. And so, I’m going to install this. There is the installer. I’ll going to say continue, continue, continue. Of course I agree, I read all that really fast. And now I’m going to install it. Okay, so now that means if I run a terminal, so this of course is start run terminal. So Python 2 is still there, but Python 3 is also now there. So we should have Python 3 installed. So we installed Python 3.6. And so there we go, and that’s all it takes to install Python 3 on the Macintosh. So let’s write our first little Python program. I’m going to, I like Atom. And so I’ve got this Atom editor, it’s atom.io. Right here, atom.io, download and install the Atom editor. I like it because Atom works the same on both Windows, Mac and Linux. And it has syntax highlighting, and so I really like things like that. So I’m going to make myself a simple Python program. Hello world, like we always do. Now you’ll notice that it’s not syntax highlighting yet, but I’m going to do a File, Save, oopsie daisy. File > Save As, and I’m going to go into my Desktop, and I want to make a folder called py4e. I’m just kind of call this hello.py. Crud, I’m gotta rename it. Rename it I ended up with two dots. Hello dot py, there we are. And so now I’m here and I’m in my home folder. I can go into my desktop and I can go into that new folder I made, Python for everybody. And I can see the files. Now, there are ways to run this and I really want you to learn the terminal so that you really know what you’re doing. And so here we are, we are in the folder that has the Python. And then all we do to run it is we say Python3hello.py and there we go. And of course this is Python 3 because I’m using parentheses there, so instead of double quotes. But Python 2 is still there. And of course if you just run Python hello.py, it’ll be a syntax error or not. Must be they added something. Yeah. because Python is still version, still version 2, but apparently they allowed print in the latest version of Python 2. So away we go. Okay, so again, thanks for watching. I hope this was helpful to you to get Python 3 installed on your Macintosh.

مشارکت کنندگان در این صفحه

تا کنون فردی در بازسازی این صفحه مشارکت نداشته است.

🖊 شما نیز می‌توانید برای مشارکت در ترجمه‌ی این صفحه یا اصلاح متن انگلیسی، به این لینک مراجعه بفرمایید.