View on GitHub

Lecture Series

Python, AI, and Cybersecurity Resources

How to Install Python on Windows

  1. Download Python
    • Go to the official Python website.
    • Click on the “Downloads” tab and choose the version for Windows (e.g., Python 3.x.x).
  2. Run the Installer
    • Open the downloaded .exe file.
    • Important: Check the box for “Add Python to PATH” before clicking Install.
    • Follow the installation wizard to complete the setup.
  3. Verify the Installation
    • Open the Command Prompt (CMD).
    • Type python --version or python to check the Python version.
      python --version
      
  4. Install Pip (Optional)
    • Pip is usually included with Python. Verify it with:
      pip --version
      

      How to Install Python on macOS

  5. Download Python
  6. Run the Installer
    • Double-click the downloaded .pkg file and follow the installation instructions.
  7. Verify the Installation
    • Open Terminal and type:
      python3 --version
      
    • Use python3 for Python 3.x because macOS might include an older Python 2.x version.
  8. Install Pip (Optional)
    • Pip is included with Python 3.x. Confirm by typing:
      pip3 --version
      

      How to Install Python on Linux

  9. Check Pre-installed Python
    • Most Linux distributions include Python by default. Check with:
      python3 --version
      
  10. Install Python Using a Package Manager
    • For Ubuntu/Debian:
      sudo apt update
      sudo apt install python3 python3-pip
      
    • For CentOS/Fedora:
      sudo yum install python3
      
  11. Compile Python from Source (Optional)
    • If you need the latest Python version, download the source code and compile it:
      sudo apt update
      sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev \
      libssl-dev libreadline-dev libffi-dev curl libsqlite3-dev wget     
      wget https://www.python.org/ftp/python/3.x.x/Python-3.x.x.tar.xz
      tar -xf Python-3.x.x.tar.xz
      cd Python-3.x.x
      ./configure --enable-optimizations
      make
      sudo make altinstall
      
  12. Verify the Installation
    • Run:
      python3 --version
      

      After Installation: Setting Up a Virtual Environment

      It’s a good practice to use virtual environments to manage dependencies for individual projects.

  13. Create a Virtual Environment
    • Run:
      python3 -m venv myenv
      
  14. Activate the Virtual Environment
    • On Windows:
      myenv\Scripts\activate
      
    • On macOS/Linux:
      source myenv/bin/activate
      
  15. Deactivate the Virtual Environment
    • When done, run:
      deactivate