The Python Mini-Degree Development Environment Guide By Zenva
Welcome! We are happy to welcome you to the premiere Python development program available on the web The Python Mini-Degree by Zenva. This document itself is a supplemental guide for the Python Mini-Degree that is distributed on the Zenva Academy. The purpose of this guide is to help you the student get started on setting up the development environment that is to be used throughout the course lessons of the Python Mini-Degree. This guide covers these main points on preparing and setting up your development environment to make the process of completing the course material as simple as possible Where to download the desktop image file for Ubuntu Downloading and installing the virtual machine software (VirtualBox) Configuring your virtual machine and the technical specifications it uses Installing the Ubuntu Operating System onto the virtual machine Running the Python Mini-Degree Environment Setup File within Ubuntu to install the packages required for the course material (such as libraries, frameworks, etc.) Setting up the default Ubuntu text editor (Gedit) to function similar to a Python IDE We are happy to have you with us and we aim to be there every step of the way during your learning journey! If you have any questions or concerns, please visit the Zenva Help Center. Cheers, and happy learning! Zenva Team The Python Mini-Degree 2017 Zenva Pty Ltd 1
Documentation Index 1. Download the Ubuntu Desktop Image 2. Download VirtualBox 3. Install and Setup Ubuntu on VirtualBox A. Installing VirtualBox B. Create the Ubuntu Virtual Machine C. Install Ubuntu on the Virtual Machine D. Download and Run the Python Mini-Degree Setup File E. Configuring the Text Editor for Python F. Test the Python Environment Download the Ubuntu Desktop Image 1. Navigate to Ubuntu s website to download the ISO file for convenience, the link is https://www.ubuntu.com/desktop The Python Mini-Degree 2017 Zenva Pty Ltd 2
2. Click on the Download Ubuntu button 3. Typically, this will take you to the page containing several versions of the Ubuntu Operating System download the topmost one, which is usually the LTS version (Long Term Support) In this example, we are downloading Ubuntu 16.04.2 LTS The Python Mini-Degree 2017 Zenva Pty Ltd 3
4. After clicking that, you ll be taken to a donation page for Ubuntu donate at your own discretion and proceed forward 5. The Ubuntu ISO file will begin downloading to your computer, it should be titled something along the lines of ubuntu-16.04.2-desktop-amd64.iso 6. Wait for the download of the file to complete, then move onto the next section Download VirtualBox 1. Navigate to the VirtualBox website located at https://www.virtualbox.org/ 2. Click on the Download VirtualBox 5.1 button (this may change depending on the latest version of VirtualBox available) 3. You ll be brought to a page containing the VirtualBox downloads for various different operating systems click on the one corresponding to the operating system of your machine For this example, we are using a Windows machine, so we will select the download for Windows hosts The Python Mini-Degree 2017 Zenva Pty Ltd 4
4. Wait for the download of VirtualBox to complete, then proceed to the next section Install and Setup Ubuntu on VirtualBox A) Installing VirtualBox If you already have VirtualBox installed, or can proceed forward with the installation on your own, you may skip to Part B 1. Double-click on the downloaded VirtualBox installation file to begin the install process 2. On the Welcome step, select Next The Python Mini-Degree 2017 Zenva Pty Ltd 5
3. On the Custom Setup step, select Next 4. On the subsequent Custom Setup step, select Next 5. On the Network Interfaces step, select Yes The Python Mini-Degree 2017 Zenva Pty Ltd 6
6. Select Install 7. Allow the installation process to complete and then launch VirtualBox The Python Mini-Degree 2017 Zenva Pty Ltd 7
B) Create the Ubuntu Virtual Machine 1. In VirtualBox, click on the New button to create a new virtual machine 2. In the subsequent screen, type Ubuntu for the name of the virtual machine (This will allow the type and version to be auto-populated otherwise, set them if they are not automatically populated) The Python Mini-Degree 2017 Zenva Pty Ltd 8
3. For the memory size, 1024 MB of RAM is the default amount for the virtual machine. You can allocate more if you d like, and this can always be changed later if needed The Python Mini-Degree 2017 Zenva Pty Ltd 9
4. For the next screen, use the option as shown below 5. Next you ll select the virtual hard disk file type. The default option VDI (VirtualBox Disk Image) should be used The Python Mini-Degree 2017 Zenva Pty Ltd 10
6. For the storage usage, select Dynamically allocated 7. For the size of the virtual hard disk, 10 GB is the default. For the purposes of the Python Mini- Degree, we suggest bumping it up to 12 GB Feel free to increase the size as per your needs, then create the virtual machine The Python Mini-Degree 2017 Zenva Pty Ltd 11
8. Once creation of the virtual machine completes, the VirtualBox window will appear as below C) Install Ubuntu on the Virtual Machine 1. Select the Ubuntu virtual machine you created, and then click on Settings 2. Select the Storage tab, and then the Adds optical drive button as shown below The Python Mini-Degree 2017 Zenva Pty Ltd 12
3. In the options displayed, select Choose disk 4. Navigate to where you downloaded the Ubuntu ISO and select it you may need to set the file type filter to All files in order to see the ISO file The Python Mini-Degree 2017 Zenva Pty Ltd 13
Select OK to proceed 5. Now you ll power on the Ubuntu virtual machine to begin the installation process Select Start to power on the virtual machine 6. Give the media a few seconds to loads you ll then be shown the following screen The Python Mini-Degree 2017 Zenva Pty Ltd 14
Select Install Ubuntu (you can click on the X to close out the notifications on the top) 7. On the subsequent screen, make sure the Download updates while installing Ubuntu is checked, then continue 8. Select the Erase disk and install Ubuntu option. This will not affect any files nor data on the host computer this only applies to the virtual machine The Python Mini-Degree 2017 Zenva Pty Ltd 15
Then, click on Install Now 9. You ll then be prompted to confirm formatting click Continue to proceed 10. Select and confirm your region (In this example, we use New York) The Python Mini-Degree 2017 Zenva Pty Ltd 16
11. Select and confirm your keyboard layout and language 12. Enter your name and the username for your account. Optionally, you can also set a password once you press continue the install will begin The Python Mini-Degree 2017 Zenva Pty Ltd 17
13. Once the install completes, restart the virtual machine The Python Mini-Degree 2017 Zenva Pty Ltd 18
D) Download and Run the Python Mini-Degree Setup File 1. Inside the virtual machine (this is, inside the Linux operating system you have installed) Open Mozilla Firefox and navigate to the course home page. Then, click on the Course Files section and click on the Python packages installation file to download the setup file Note: This step, and all subsequent steps take place within Ubuntu in the virtual machine 2. You will be prompted to either open or save the file select the option Save File The Python Mini-Degree 2017 Zenva Pty Ltd 19
3. Click on the Files application on the left-pane, and open the Downloads folder 4. Navigate to the setup file (zipped folder) and right-click it to extract the script itself The Python Mini-Degree 2017 Zenva Pty Ltd 20
5. Once the extraction is complete, you ll have a file titled installer.desktop in the folder Right-click the file and click Properties The Python Mini-Degree 2017 Zenva Pty Ltd 21
6. In the displayed window, select the Permissions tab and check on the box that says Allow executing file as program then close out the window 7. After having set the file to be executable in the previous step, right-click on the file and select Open to begin execution of the script The Python Mini-Degree 2017 Zenva Pty Ltd 22
8. A terminal window will be displayed prompting for the password you set when you created your account type it in and press enter Note: When typing your password, no characters will be displayed on the entry line, this is normal. If you are unsure of what you typed for your password, delete any characters you might have typed and enter your password again 9. Once you ve successfully entered your password, the packages that will be installed by script will be displayed Simply type Y to confirm and then press enter The Python Mini-Degree 2017 Zenva Pty Ltd 23
10. Once all of the libraries have finished installing, you ll see Finished Installing... After that, press any key such as enter to confirm. This will close the window 11. Open a new terminal window using Ctrl + Alt + T Then run the below commands to update the package lists and installed any updated software sudo apt-get update sudo apt-get upgrade You can then close the window and proceed with the next section The Python Mini-Degree 2017 Zenva Pty Ltd 24
E) Configuring the Text Editor for Python 1. Press the Windows key on your keyboard (or click on the Ubuntu icon on the left) and type Text Editor into the search bar This will bring up the text editor application (known as Gedit) click on the icon to launch it 2. Once Gedit launches, click on the Edit menu button at the top left Then select Preferences from the displayed drop-down menu The Python Mini-Degree 2017 Zenva Pty Ltd 25
3. In the Preferences pop-up window, click on the Plugins tab Select the item External Tools such that it is checked on (by default the item is unchecked) Then click the X on the top-left of the window to save the change 4. Click on the Tools menu button, then select Manage External Tools from the drop-down menu The Python Mini-Degree 2017 Zenva Pty Ltd 26
5. In the displayed window, click on the + button to add a new tool This will create a new tool entry called New tool click on it to modify its properties The Python Mini-Degree 2017 Zenva Pty Ltd 27
6. Rename the entry to Execute Python Code, and in the right-side pane enter the following code #!/usr/bin/env python import sys exec(sys.stdin.read()) Then set the following fields Shortcut key: Alt + Q (you ll have to click into the field and then press both buttons simultaneously to set this shortcut) Input: Current selection (default to document) this you ll select from the drop-down menu Applicability: All documents Python, Python3 these you ll select from the drop-down menu Your settings for the tool will then look like this The Python Mini-Degree 2017 Zenva Pty Ltd 28
F) Test the Python Environment Note: This step, and all subsequent steps are done in Ubuntu within the virtual machine 1. Open Gedit to a new file The Python Mini-Degree 2017 Zenva Pty Ltd 29
2. Save the new file by using the Save As function Click on the File menu button, and select Save As from the drop-down menu 3. Navigate to the Desktop folder (or whichever folder you d like to save the file in) Then, give the file a name we use test.py in this example Note: Make sure to give the file a file extension of.py, then click Save The Python Mini-Degree 2017 Zenva Pty Ltd 30
4. After having saved the file, type some Python code into it so we can test that the Python code execution tool works In the example below, we type print Hello world! 5. Once you ve entered the code, simply use the shortcut we defined before, which was Alt + Q You ll see the Python code executed in the Tool Output pane, on the bottom of the editor The Python Mini-Degree 2017 Zenva Pty Ltd 31
Congratulations! You ve completed setting up the Python Development Environment for your Ubuntu virtual machine! The Python Mini-Degree 2017 Zenva Pty Ltd 32