3.1.12 Lab - Explore Python Development Tools
3.1.12 Lab - Explore Python Development Tools
Instructor Note: Red font color or gray highlights indicate text that appears in the instructor copy only.
Objectives
Part 1: Launch the DEVASC VM
Part 2: Review the Python Installation
Part 3: PIP and Python Virtual Environments
Part 4: Sharing Your Virtual Environment
Background / Scenario
This course has some basic expectations for students, that they have some background in Python and some
hands-on experience with programming. Lab practice with Python gives your fingers the "muscle memory" to
work more efficiently in Python. However, initially it is important for you to know how to maintain a Python
development environment.
In this lab, you review Python installation, PIP, and Python virtual environments.
Required Resources
• 1 PC with operating system of your choice
• Virtual Box or VMWare
• DEVASC Virtual Machine
Instructions
a. In the DEVASC VM, you can check the version of Python already installed with the python3 -V
command.
devasc@labvm:~$ python3 -V
Python 3.8.2
devasc@labvm:~$
b. To see the directory for the local Python environment, use the which python3 command.
devasc@labvm:~$ which python3
/usr/bin/python3
devasc@labvm:~$
© Enter copyright date here - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 1 of 5
www.netacad.com
Lab - Explore Python Development Tools
© Enter copyright date here - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 2 of 5
www.netacad.com
Lab - Explore Python Development Tools
© Enter copyright date here - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 3 of 5
www.netacad.com
Lab - Explore Python Development Tools
b. Send the output of the pip3 freeze command to a text file called requirements.txt.
(devfun) devasc@labvm:~/labs/devnet-src/python$ pip3 freeze >
requirements.txt
c. Deactivate the devfun virtual environment. You can use the ls command to see that the
requirements.txt file is in the /python directory.
(devfun) devasc@labvm:~/labs/devnet-src/python$ deactivate
devasc@labvm:~/labs/devnet-src/python$ ls
devfun file-access-input.py if-acl.py requirements.txt
devices.txt file-access.py if-vlan.py while-loop.py
devnew hello-world.py person-info.py
© Enter copyright date here - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 4 of 5
www.netacad.com
Lab - Explore Python Development Tools
© Enter copyright date here - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 5 of 5
www.netacad.com