filmov
tv
Python Training | How to Install PyDev Plugin in Eclipse and How to Create a Simple PyDev Project

Показать описание
So I have right here is my Eclipse integrated development environment and the first thing we need to do to install PyDev is to go up to here to HELP and then Eclipse Marketplace. This just takes a moment and we're going to perform a little quick search here in the find box and I'll type in PyDev and then hit the search button. So you see here is the PyDev, Python IDE for eclipse and so we just hit the install button right here. We've got a couple choices here, we have PyDev for Eclipse and then we have extra Python Mylyn Integration. I really just want basic support for Python so I'll just hit Python for Eclipse and then I'll hit next. Okay here's the license agreement; quickly read through all of this and then accepted license terms and then hit finish.
It'll just take a minute or two it to install you know depending on how fast your network connection is. And once it's finished installing you're going to have to restart Eclipse. Now this popped up right here "do we trust these certificates" go ahead and check this and say okay. Now we need to restart Eclipse for the changes to take effect. Go ahead and say "yes". Now I'm going to go to file new and you'll see that it says here no applicable items. You may or may not have this kind of behavior, but in case you do all you need to do is go to the default perspective. Remember perspective is just the collection of windows that's visible in your Eclipse environment it also controls what kind of projects you have access to. So it looks like I don't have any perspectives opened. So I can just go to my window here and say OPEN PERSPECTIVE and then OTHER. For right now I'll just say, oh here we go here is my PyDev Perspective, I can make that the opened one. Now here we have our PyDev Package Explorer. Now there are other windows to choose from, you'll see here that I can go to Window, Show View and we have all these other windows to choose from here. Okay so if i want to open up the console to see output from my programs I can do that.
So I'm going to just create a real quick Python program, just go up to FILE, New. I'll create a PyDev project. I will just call this "First Python Project." I'm going to click on this link here to configure the interpreter that I have and I just so happen to have Python 2.7 installed directly on my C drive so it looks like it's already there, but if for some reason this is blank here you can always go to NEW and point to it.
Okay so i can just hit cancel here. I'm going to stick with all the defaults on this page here and just hit finish. So here it is my project and this will automatically show up in here, I can actually collapse this. Inside of my project I'd like to create a Python class. So I can right click on here and I'll say NEW and I'll say PyDev module. I'm going to call this package "com dot firebox training" and I'm going to call the name of my class, I'll make this the Person class and I'll hit finish. Now there are all these other templates in there too. You can play around with that too so you know what the templates contain. This is just a request for you to donate and I'm just going to X out of here for now.
Here we have our skeleton code. So I'm just going to create a new class that is called PERSON. It's a subclass of object. I have a Constructor so you'll see here that the IDE here automatically auto completes when I am creating functions in here. So if I want my Constructor to take a first name and last name, I can do that and I have default values of empty strings. Self simply refers to the object itself that's getting instantiated, so SELF.firstname equals first name. Okay so this has to do the attributes of the object itself this is the local variable that's getting pasted in right here.
Now I'm going to now print out P and we're going to now run this.
Комментарии