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

preview_player
Показать описание


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.
Рекомендации по теме
Комментарии
Автор

Very Good introductory tutorial. Excellent Audio. Excellent Voice modulation

rmnair
Автор

You can have both Python 2.x and 3.x installed on your machine. Within your PyDev project, you can configure which interpreter to use. All you need to do is right-click on the project, go to Properties, then PyDev->Interpreter/Grammar.

FireboxTrainingCourses
Автор

It was just a perfect explanation. Well done

pedrotavares
Автор


Thank you so much. Extremely helpful.

AndreasWiencek
Автор

I ran into two problems while following this, firstly @3:55 my Eclipse platform didn't automatically create the Package I had to right click FirstPythonProject > New > Pydev Package, and then create it myself. Secondly @7:25 watch carefully as she indents lines 15 & 16, this is important otherwise your code won't work (luckily I'd already heard that Python is a little temperamental about small things...). Other than that a great help to getting me started! Thanks

vincebell
Автор

You need to find out the full directory path of your Python project and add it to the PYTHONPATH environment variable. To find the directory, right-click on on the PyDev project, go to Properties, then Resource.

FireboxTrainingCourses
Автор

I have a question here... When I run a script from pydev, the console at the bottom of the window shows me any output/error message I get. But in your example, say I want to do pp = Person(name, surname), and I want to do that in the interpreter without having to run the script again (you can do that in IDLE). How do I do that in Eclipse Pydev? Thank you! And congrats for these great vids

hidetoxjapan
Автор

Hi, there is one part I don't understand that is not listed in this video. In Pydev's interactive console, I do not know how to import python modules created within Pydev. For instance, I created point.py but cannot import it in the console. I added the source folder to the path but it still doesn't work.

frogger
Автор

This script gives me a TypeError: object() takes no parameters for line 14

finhunter
Автор

does PyDev interfere with the regular python3.3.2 that I have installed on windows or is the plug-in only restricted to the eclipse environment?

waleedqk
Автор

@8:01 could we have written like this?
import com.fireboxtraining.Person as fp
would it have been easier too or am I wrong.

PradeepChauhan
Автор

The video is not clear. Not necessarily the instructions but you can't see what's being type vividly.

jahwurks
Автор

a non-indian accent teacher? what is this?

TasX
visit shbcf.ru