Getting Started with Python: Windows and Linux Setup

By Irving Ernesto
Picture of the author
Published on
Python programming computer

Python is a powerful and versatile programming language perfect for beginners and experienced programmers alike. If you want to learn Python, the first step is setting up your development environment. Here's a simple guide for both Windows and Linux users.

Windows

  1. Download Python:

  2. Run the Installer:

    • Open the downloaded installer and follow the prompts.
    • Crucial: Check the box to "Add Python to PATH" during the installation. This lets you access Python from the command line.
  3. Verify Installation:

    • Open a command prompt (search for "cmd").
    • Type python --version and press Enter. If successful, you'll see the installed Python version.

Linux

Most Linux distributions come with Python pre-installed, but it's often an older version. Let's make sure you have the latest:

  1. Check Existing Version:

    • Open a terminal window.
    • Run python3 --version.
  2. Update or Install (if necessary):

    • Ubuntu/Debian: Use the apt package manager:
      sudo apt-get update
      sudo apt-get install python3
      
    • Fedora/CentOS: Use the yum package manager:
      sudo yum install python3
      
  3. Verify Installation:

    • Run python3 --version in your terminal. You should see the updated version.

Code Editor/IDE

Now you need a place to write your Python code! Here are some popular choices:

Installing Packages (pip)

Python comes with a wealth of built-in functionality, but its real power lies in external packages. You'll use "pip," the package installer for Python.

  • Example: Installing NumPy (a popular scientific computing package):
    pip install numpy
    

Hello, World!

Let's write your first Python program:

  1. Open your chosen code editor/IDE.

  2. Create a new file and name it hello.py.

  3. Type the following code:

    print("Hello, World!")
    
  4. Save the file.

  5. To run it:

    • Open a terminal or command prompt.
    • Navigate to the folder where you saved hello.py
    • Type python hello.py and press Enter.

You should see "Hello, World!" printed on your screen!

Congratulations! You've got Python running on your system and are ready to start coding.

Additional Tips

  • Virtual Environments: Consider using virtual environments to isolate your projects and avoid conflicts between different package versions.
  • Learn the Basics: Start with a good Python tutorial or online course to understand the fundamentals of the language.

Stay Tuned

Want to learn Python?
The best articles, links and news related to Python delivered once a week to your inbox.