LESSON 3

 

Installing Python and packages

Lesson 3

Screen 1 of 14

Course progress review

This is lesson 3 of 8

 

1) Components of a Web application

2) Web frameworks and Flask

3) Installing Python and packages

4) Creating your development environment

5) Building your first local Flask app

6) Running your first Flask app

7) Web application deployment

8) Deploying to PythonAnywhere

Lesson 3

Screen 2 of 14

Lesson 3 outcomes

This lesson prepares you to:

 

  • understand what Python is
  • download a specific version of Python
  • successfully install Python on your computer
  • recall that the pip package manager installs packages

Lesson 3

Screen 3 of 14

The Python website describes Python as:

 

"a programming language that lets you work more quickly and integrate your systems more effectively."

Lesson 3

Screen 4 of 14

What is Python? According to website.

Python's developers describe it as:

 

"an interpreted, interactive, object-oriented programming language"

 

The next slides will explain the jargon

Lesson 3

Screen 5 of 14

What is Python? According to developers.

What is Python? Jargon explained.

Interpreted: each time a program is run, the interpreter checks through the code for errors and interprets the instructions into machine readable "bytecode"

 

Interactive: Python offers the possibility of entering a Python statement followed by the return key, with the result printed on screen. This is an advantage for de-bugging and is a natural way of working

 

Object-oriented programming (OOP): A programming language organised around objects rather than actions and data rather than logic - this offers a number of advantages over other programming styles shown on the next slide

Lesson 3

Screen 6 of 14

Object oriented programming (OOP) offers several advantages over other programming styles:

  1. Objects can easily be reused in other programs
  2. To reuse and objects its not necessary to know why it was created.
  3. Objects can hide parts of themselves from programmers, protecting their integrity
  4. OOP programming process makes for better deign and fewer errors with large programs
  5. OOP is easier to modify and maintain, although they demand much initial planning

Lesson 3

Screen 7 of 14

What is Python? Its advantages.

Now let's install Python!

Installation of Python      1/2

The Flask Web application you will create (in lesson 5) will be built using Python.

 

You can install the latest version of Python by:

  1. Going to https://www.python.org/downloads/

    • download the latest version of Python V3.xx

    • choose install now and check add Python to PATH

    • if you chose download only - goto your downloads directory and run the python-3xx.exe installer file

Lesson 3

Screen 8 of 14

Next we will verify that installation was successful

Installation of Python     2/2

To test that Python installed on your computer:

Lesson 3

Screen 9 of 14

for details

1. Open a Windows command prompt (cmd)

  • Type cmd into the Windows search box, press return and select the cmd launcher icon

2. Type 'python' into cmd, then press return

3. To close Python, type 'quit()' into cmd and press return

about your installed Python version (as shown).

Python packages & modules

Lesson 3

Screen 10 of 14

Developers can organise sections of code, which relate to the same feature(s), by grouping them into a single file.  For example, all code that displays a login prompt to an end-user can be saved into one file.

Simply put: 'Python has packages for directories and modules for files' (Programiz 2018).

All files containing code to create all end-user displays (or 'views') can then be group in directories.

You will install packages for Python in Lesson 4, to build your first Web Flask application.

pip package manager

Lesson 3

Screen 11 of 14

pip is a command line program for downloading, installing and managing shared Python packages.

The default source of packages pip installs is the Python Package Index (PyPI).  PyPI contains packages that have been approved for use by Developers.  For example, Flask is a Python package, with many modules, available from PyPI.

pip is included with Python since version 3.4 (Python Packaging Authority 2018).

Developers can share useful packages and modules.

Python quiz

Lesson 3

Screen 12 of 14

Complete the quiz to test your knowledge of Python.  Move forward to reveal the answers.

1. Python is an 'interpreted' computer language.  This means (select A, B or C):

2. Object oriented programming makes development faster, but the code is difficult to reuse. True or false?

3. What cmd command displays details about the version of Python installed on a computer (choose A, B, C)?

A. Python can interpreted as a European language.

B. Python can interpret other computer languages.

C. The Python interpreter checks the code for errors, when a Python program is run.

A. python    B. version    C. flask

C. The Python interpreter checks the code for errors, when a Python program is run.

True

A. python

Lesson 3 review

You have completed Lesson 3 on installing Python and packages.  You  can now:

 

  • understand what Python is and its advantages
  • select a version of Python and install it
  • verify that the installation has been successful
  • recall that pip installs packages

Lesson 3

Screen 13 of 14

Next lesson

In lesson 4 you apply what you learned about Python and pip, to prepare your computer for creating your first Flask app.

 

 

Proceed to lesson 4.

Lesson 3

Screen 14 of 14

Made with Slides.com