Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 1

636 bytes added, 15:32, 9 May 2019
LAB OBJECTIVES
= LAB OBJECTIVES =
:In advance of this lab, you will install a current distribution of Linux to be used as in a host machineVirtual Machine on your external SSD. You will NOT be required to setup Virtual Machines for do all of your future work within this lab VM (that will be covered in a future labincluding quizzes!). You will then setup your Python scripting environment on your host machine, including the setup the of '''python''' libraries and also the setup of a user-friendly interactive Python environment called '''ipython'''. You will also install additional framework tools (such as '''git''', '''vim''', and '''tmux''') to be used in later labs.
:After selecting an appropriate text editor to use, then you will start to create '''Python''' scripts to learn basic operations such as: '''printing text''', '''using objects''', and performing '''math operations'''.
::*'''Boot media / Installation:''' CentOS7 Full Install DVD
:::*Download at Seneca College: CentOS 7 Full Install DVD (image file): http://belmont.senecacollege.ca/pub/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso
:::*Download outside Seneca College: http://mirror.csclub.uwaterloo.ca/centos/7/isos/x86_64/CentOS-7-x86_64-EverythingDVD-1810.iso
::*'''Disk space:''' 50GB
::*'''CPUs:''' 4(Number of processors: 1, Number of cores per processor: 4)
::*'''Internal Memory:''' 8GB
::*'''Environment:''' GNOME Desktop
<!--==== Environment Setup ====
:'''Perform the following steps:'''
:#Regardless of the Linux distribution that is used for this course, these lab will be using and referring to the current version of '''Centos7CentOS 7''' (Graphical Desktop) for our main Linux machine. When creating your VM, refer to the '''Details / Minimum Requirements''' section above for assistance. :#Install Centos7 CentOS 7 VM selecting the default partitions. When you have finished the installation of Centos7CentOS 7, you may proceed to the next step.
<blockquote style="margin-left:35px;">{{Admon/important|style="padding-left:25px"|Unit Feedback Scripts|Each '''Part''' (within an 'Investigation) is referred to as a '''Unit'''. Each Unit will require that the student download and run a '''Unit Feedback Script''', which provides the OPS435 student "real-time feedback" of their completed work.<br>This feedback is not considered to be perfect or fool-proof; however, it may provide feedback (hints) in case a student gets stuck or experiences an error when performing administration tasks or when creating their Python scripts. These unit feedback scripts can also be used to confirm that the student's Python script is on the right track, and provide a consistent record of their Python scripting progress throughout their labs.}}</blockquote>
=== PART 2 - Setting up Your Python Environment For Labs ===
In order to learn how to use python on your Linux machine, it is important to setup your Linux environment and learn how to interact with a Python shell. The following should be done on a terminal as the superuser (i.e. root).
yum install python34 python34-devel # Install python3.4 and python3.4 development libraries
yum install python python2-devel # Install python2.7 and python2.7 development libraries
</source>
:#We now need to create a link to python3.4:<source lang="bash">
cd /bin
ln -s python3.4 python3
</source>
:#Next, you will install a couple of useful applications called '''tmux''' and '''screen'''. They are referred to as '''terminal multiplexers'''. If you plan to spend a lot of time in the terminal, this powerful tool will help you get it done. Lets install it and plan to use it later:<source lang="bash">
yum install python-pip # Install python2.7 pip
yum install python34-pip # Install python3.4 pip
</source></li>
<li style="margin-left:25px;">Upgrade python34-pip with the following command:<source lang="bash">
pip3.4 install --upgrade pip
</source></li>
<li style="margin-left:25px;">Issue the following command to install '''git''':<source lang="bash">
pip3.4 install ipython # Install ipython for python3.4
</source></li>
<li style="margin-left:25px;">Issue Exit from the superuser shell to your regular user shell and issue the following commands in your shell to check your work for this section:<source lang="bash">mkdir -p ~/ops435/lab1/
cd ~/ops435/lab1/
pwd #confirm that you are in the right directory
:'''Perform the following steps:'''
:#Make sure you're using your regular user login and not using the root user for the following section.
:#To access the '''ipython''' shell, issue the following command:<source>
ipython3
:'''Be able to answer any questions about the lab to show that you understood it!'''
<br>:'''For sections A & B:''' ::<brspan style=color:green;font-size:1.5em;">&#x2713;</span> Submit your output and Python scrips via Blackboard instead.
= LAB REVIEW =