Lecture’s Description
1. Lecture Overview
In the previous lecture, we covered what Python is and who should learn it. We also discussed the skills you can develop after learning Python. In today’s lecture, we will focus onsetting up Pythonon your system. We’ll go through the installation steps for the necessary tools, and then execute our first Python program.
2. Why Do We Need to Set Up Python?
Before you can start writing and running Python code, you need to install Python and some essential tools on your computer. These tools will help you manage Python packages, create virtual environments, and make coding easier.
3. What We Will Install Today
Here’s a step-by-step breakdown of what we’ll install:
- MinicondaorAnaconda
- VS Code(Integrated Development Environment or IDE)
These installations will make it easier for us to work with Python efficiently.
4. Step 1: Install Miniconda or Anaconda
What are Anaconda and Miniconda?
- Anacondais a full package that includes Python and over 1 GB of libraries and tools, including Jupyter Notebook and Spyder.
- Minicondais a lightweight version of Anaconda, suitable for users who only need Python and essential tools.
Why Miniconda?
If you prefer a smaller installation and only need the basics for Python programming,Minicondais the better choice. It will use less space and be easier to set up.
4.1 Installation Process
- Search for Miniconda: Open your web browser (preferably Google Chrome) and search for “Download Miniconda.”
- Download: You’ll be directed to the Miniconda download page. Select the version appropriate for your operating system (Windows, macOS, or Linux).
- Start Installation: Once the installer is downloaded, open it and follow the prompts:
- ChooseNextandAgreeto the terms.
- Choose the installation location (you can keep the default).
- Select the option toAdd Miniconda to PATHfor easier access.
5. Step 2: Install VS Code
What is VS Code?
VS Code is a free, open-source code editor that makes it easy to write, edit, and run Python code.
Installation Steps:
- Download: Go to theVisual Studio Code websiteand download the installer for your operating system.
- Install: Run the downloaded file and follow the prompts to complete the installation.
6. Step 3: Verify Python Installation
Once Miniconda is installed, it’s time to verify that Python is properly installed.
6.1 Check Python Version
- Open theAnaconda Prompt:
- Press theWindows keyand type “Anaconda” in the search bar. SelectAnaconda Prompt.
In the Anaconda Prompt, type the following command:
bash
CopyEdit
python –version
If Python is installed correctly, you should see a version number (e.g., Python 3.12).
Alternatively, you can use this command to check:
bash
CopyEdit
python –version
If you donotsee a version number, this means the installation didn’t work, and you may need to reinstall Miniconda or Anaconda.
7. Step 4: Running Your First Python Program
Now that you have everything installed, it’s time to run your first Python program.
- Open VS Code.
- Create a New File: Click onFile > New File.
Write Your Program: Type the following simple Python code:
python
CopyEdit
print(“Hello, World!”)
- Run the Program:
- Save the file with a .py extension (e.g., first_program.py).
In VS Code, click onTerminal > New Terminaland type:
bash
CopyEdit
python first_program.py
- You should see“Hello, World!”printed in the terminal.
8. Summary of Key Points
- Miniconda vs. Anaconda: Miniconda is a lightweight version, whereas Anaconda includes more tools and libraries.
- VS Codeis a code editor that makes it easy to write and run Python code.
- Python Setup: After installing Miniconda and VS Code, always check your Python installation with python –version.
- First Program: Running a simple Python program, such as printing “Hello, World!”, is the first step in your journey.
9. Conclusion
You’ve successfully set up Python on your system and executed your first program! In the next lecture, we will dive deeper into Python programming concepts like variables, data types, and basic operations. Keep practicing and stay excited about learning!
This guide will help you get started on your Python programming journey. If you have any questions, feel free to ask! Happy coding!