课程: Hands-On Advanced Python: Data Engineering Basics
Getting set up: Codespaces - Python教程
课程: Hands-On Advanced Python: Data Engineering Basics
Getting set up: Codespaces
- [Instructor] There are a couple of different ways you can work with the example code in this course. I've set up a GitHub repository with the examples, and you can find it at this link. The course content is organized into two separate folders. The finished folder contains all of the code examples in their completed state, so you can compare your code against them as you work through the course. The Start folder contains the code examples in their beginning state, and this is the folder I'll be working in throughout the course as we build towards the finished state for each example. If you want to download the examples and work with them locally on your computer, that's easy enough to do. You can clone the repository or download a zip file and then use your favorite code editor to work on them. You'll just need to make sure that you have Python installed on your computer, at least version 3.10, in order to use the examples. But this repository has also been set up with a GitHub Codespace so you can just work directly online with nothing to install. All you need to do is fork a copy of the repository in your own GitHub account and then fire up a Codespace here in the code menu. Just click on Codespaces, click on this little plus sign right here, and that will create a Codespace for you and you won't need to install anything. Now you can see that I've already done that and this is the Codespace that I'm going to be using in the course. Either way works fine. If you want to download the files and work locally, that's great, but I'm going to be using the Codespaces feature in this course. So let me open the Codespace and show you what it looks like. And it may take a moment when you start up your Codespace, so just be patient, it can take a couple of seconds to get going, alright. So let's make sure this is closed, okay. So when the Codespace starts, you'll see a browser based version of Visual Studio Code, and here in the left hand portion of the screen, you'll see the files that you'll need for the course. There's also a built-in terminal, which can be found in the View menu, so if I go up here and I go to the View menu, I'm going to choose Terminal, or you can type control and then back tick, so when I start up the built-in terminal, I can check to make sure that Python is already installed, so I'll type python --version, and sure enough, you can see that we've got Python 3.10.4 installed. You also want to make sure that you have the Python and Pylance extensions installed. Now VS Code might actually prompt you to do this when it starts up because it will recognize that you're working in a Python workspace. And since this is my own workspace, I've got these extensions already installed. What you'll do is you'll click on this little boxes icon right here and you can see I've got Pylance and Python. You can find them in the marketplace, so if I click on the Python extension here, this is actually the only one you need to install because when you install this, this will install Pylance for you. So if it's not already installed and VS Code doesn't prompt you for it, go ahead over to the extensions marketplace, search for this Python extension, it's the one from Microsoft, it's the one with all the downloads, so that's the one that you want to install. Install this and then you'll be able to work with Python really easily within VS Code. There's one other thing to check quickly to make sure the preferences are set. So what I'm going to do is up here in this menu, I'll go to File, and in Preferences, I'll check Settings, or you can type control comma to bring this up. So once you bring up the settings, do a search on the word execute, and you'll see that as you do this, there's a preference right here called Execute in File Dir. This should be checked. If it's not, then go ahead and check it and then you can just go ahead and close the settings and that will save them. And that's pretty much all there is to set up.