In this video, learn how to set up your development environment.
- Hello, and welcome to Python projects. In this video, we will be setting up our Python Development environment. We will start by first installing the latest version of Python 3.5, then we will install the Eclipse IDE with the PyDev plugin, and we will also install the required version of the Java Runtime. We install Python by going to python.org/downloads. In this video, we will be using the 64-bit version.
So we click on Windows, which brings us to different installers. Scroll down a little bit. We find Python 3.5.1, and 64-bit installer, and we download that. On Windows 10, you might have to right-click the installer executor build, and choose Run as Administrator, in order to get installation process started. One thing that's very important is to click that checkbox down here, Add Python 3.5 to the Windows Path, because that will make everything easier later on.
So after that, we click on Install Now, and then the installation process of Python 3.5.1, 64-bit version, gets started. And after a little while, it will complete. Here we are at the end of installation process, installation of Python 3.5.1, the 64-bit version in our case, and it's almost done. It's usually pretty fast. So once it's done, you should see that setup was successful.
That's what we want, and that's all we need to do to install Python. Yeah, here we go, setup was successful. Because during the installation of Python, we added Python to the Windows Path, you can verify which version, bit version, of Python we did install by opening a command prompt, and simply typing Python at the command prompt. Press and enter, and here we see what version we did install. It says Python 3.5.1, the 64-bit version.
Next we will install the eclipse IDE. We do that by going to eclipse.org/downloads. On this downloads site, different installers, and different options. So the first thing at the top of the list is the Eclipse IDE for Java Developers, but it's the EE version. EE means the Enterprise Edition. That version makes everything a little bit more complicated, and for us, as Python developers, we don't need that version at all.
What we really want is the simpler one, which is called Eclipse IDE for Java Developers, without the EE in the middle. And in order to match the Python version we did install a little bit ago, we want to choose the 64-bit version and download it. Eclipse IDE requires a Java Runtime. We can download the correct version that matches our 64-bit versions of both Eclipse and Python from the official Java website, and Java downloads for all operating systems.
And down here is the correct Windows 64-bit version. After I have downloaded the correct 64-bit version of the Java Runtime, we can just accept the default installation folder. Click install, and Java Runtime will get installed. Again, it's necessary for the Eclipse IDE. Java Runtime needs to be installed, and it says we have successfully installed Java. We can verify which version of Java we did install by opening a new command prompt, and typing in java -version, pressing Enter, and this tells us which version of the Java Runtime, and which bit version we did install.
After we have installed the Java Runtime, we can use Eclipse. And we do that by simply double-clicking the eclipse.exe, which will open up the latest version of Eclipse. On the first time, it will prompt us to create a workspace, choose whatever path you like. And here we go. Eclipse is starting up. It relies on the Java Runtime. Where once we have Eclipse up and running, we going to use it for our Python software development.
In order to use Eclipse for Python development, we need to download the PyDev plugin for Eclipse. And we do that by going to Help, Eclipse Marketplace. Once this dialog box pops up, next to the Find label, you can just simply type in PyDev, and press Enter. So it'll search the internet, and it will bring up the latest version of PyDev, version Python IDE for Eclipse, and it's very easy.
You just click on Install, and that will install the PyDev plugin for the Java-based Eclipse IDE. So we can use Eclipse for Python Development. Once this is done, we might not notice anything different in the Eclipse IDE. It's Java-based, so it'll say Java on the top. Once the PyDev plugin has been successful installed, we will see a new little button, which will enable us to use Eclipse IDE for our Python programming.
The other IDEs like NetBeans, Spyder, Sublime, PyScript, there are many of them. After we have installed PyDev within Eclipse, we want to select it. So the way to do it is to go to Window, Perspective, Open Perspective, and by default it's an Other Perspective. Plus we just installed PyDev. So we're going to click on here and choose Okay, and that will open up the PyDev Perspective. This can be seen on the right top corner, and also over there.
Let us next create a small Python program within the Eclipse IDE with the PyDev plugin. So the way to do that is we go here, click on PyDev Project. We give it a name. We choose the Grammar version of the Python Interpreter, and we are using 3.5, so 3's good. And what you might notice here is that the Finish button is disabled. We cannot finish our new project, and the reason is because we haven't chosen an Interpreter of the Python language.
We could have several. So we go here, and click autoconfig will do the trick. This will find the only version of Python we've installed, which is 3.5. Now the Finish button is enabled, just click on Finish, and we have our Project, not much to it yet. What we can see is we have the Python 3.5 Interpreter, and now we can create PyDev module. We don't need a package yet.
First call it, Fun, and get rid of the boilerplate here. And just use regular Python syntax. We'll just do a simple Print statement, and call it everything we want. Let's call it Hello Python, and we can save it. You want it as a Python Run, and this string of the Print statement. We have printed to Eclipse console.
We can also do the same from a command. This is Introduction to How to use Python.
Note: This course was created by Packt Publishing. We are pleased to host this training in our library.
- Running Python programs within Eclipse
- Setting breakpoints
- Using the PyDev debugger
- Using design patterns
- Creating a GUI application with Tkinter
- Writing a Windows scheduling service