Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Python Tutorial

Class 1
Today’s Objectives
• Preliminary introduction to Python and related concepts

• Install Anaconda

• Install packages

• Install PyCharm

• Create a Python file in PyCharm and obtain help files for packages

Page.1
Introduction to Python-related concepts
• Python
• A high-level, general-purpose programming language.

• The latest version is Python 3.12.2. Make sure your version is Python 3.x.

• In this class, we install Anaconda instead of downloading Python directly from the official website.

• Anaconda
• A comprehensive distribution of Python bundled with a wide range of tools, libraries, and packages.

• Libraries and packages: Collections of modules that offer a wide range of functions.
• Examples: numpy, pandas, math, matplotlib, seaborn, sklearn……

Page.2 • Commonly used packages are integrated in Anaconda.


Introduction to Python-related concepts
• Integrated Development Environment (IDE)
• where you edit and execute code.

• Examples: Jupyter Notebook, JupyterLab, Spyder, PyCharm

• Some IDEs offer intelligent code completion, code inspections, AI assistance.

• We will explore PyCharm in this class, but other IDEs are also optional for programming.

Page.3
Install Anaconda
• https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ (Recommended)

• https://www.anaconda.com/download

Page.4
Install Anaconda

Page.5
Install Anaconda

Page.6
Install Anaconda

• If Anaconda3 was not automatically added to your PATH environment variable for any reason, please refer to
https://blog.csdn.net/m0_61607990/article/details/129531686 for manual steps to set up the environment.
Page.7
Install Packages
• Open a command-line interface:
• Windows: Press Windows+R, then key in ‘cmd’ in the popup window.

• Mac: Click the Launchpad icon in the Dock, type Terminal in the search field, then click Terminal.
Or, In the Finder, open the /Applications/Utilities folder, then double-click Terminal.

• Anaconda Prompt

• Use pip or conda to manage packages


• pip list, pip install Package, pip install –upgrade Package, pip uninstall Package

• conda list, conda install Package, conda update –all, conda update conda, conda remove Package

Page.8
Install PyCharm
• https://www.jetbrains.com/pycharm/download

Page.9
Explore PyCharm
• Explore the Settings in the main menu
• Keymap: Check or change shortcut keys

• Editor - File and Code Templates: Add descriptive notes on the top of every Python file

• Editor - Live Templates: Insert code templates using abbreviations


• E.g. “liter” for “for … in …”
Page.10
Explore PyCharm
• Create a project and set location and interpreter type

Page.11
Explore PyCharm
• Create a Python file within the project
• Right-click the project name – New – Python File

• Obtain help files for modules / classes / functions / methods

Page.12
See you next week

You might also like