How Can I Run Python in Atom?

Atom is a powerful, open-source text editor developed by GitHub that can be configured to run Python code efficiently. By installing the right packages and configuring the environment properly, you can write, edit, and execute Python programs directly within Atom.

Step 1: Install Atom Text Editor

First, download and install Atom from the official website. Atom is a free, cross-platform text editor that works on Windows, macOS, and Linux.

Installation Steps:

  • Visit https://atom.io/
  • Download the installer for your operating system
  • Run the installer and follow the setup instructions
  • Launch Atom after installation

Step 2: Install Python on Your System

Ensure Python is installed on your system and accessible from the command line. You can verify this by opening a terminal and running ?

python --version

If Python is not installed, download it from python.org and add it to your system PATH.

Step 3: Install the Atom-Runner Package

Atom-Runner is a package that allows you to execute code directly within Atom. Install it using one of these methods ?

Method 1: Using Command Line

Open your terminal and run ?

apm install atom-runner

Method 2: Using Atom Interface

  • Open Atom
  • Go to File ? Settings ? Install
  • Search for "atom-runner"
  • Click Install on the atom-runner package

Step 4: Configure Atom-Runner Settings

After installing atom-runner, configure it for optimal Python execution ?

  1. Go to File ? Settings ? Packages
  2. Find "atom-runner" in the installed packages list
  3. Click Settings
  4. Ensure the package is enabled
  5. Optionally, customize the runner commands for Python

Step 5: Write and Execute Python Code

Now you can create and run Python programs directly in Atom ?

Creating a Python File

  1. Open Atom
  2. Create a new file (Ctrl+N or Cmd+N)
  3. Save the file with a .py extension
  4. Write your Python code

Example Python Program

# hello.py
def greet(name):
    return f"Hello, {name}!"

print(greet("Python"))
print("Welcome to Atom!")

# Simple calculation
numbers = [1, 2, 3, 4, 5]
total = sum(numbers)
print(f"Sum of {numbers} = {total}")

Running the Code

Execute your Python code using these keyboard shortcuts ?

  • Ctrl+Shift+B (Windows/Linux) or Cmd+Shift+B (macOS)
  • Or right-click and select Run Code
  • Or use the command palette: Ctrl+Shift+P and type "atom-runner run"

The output will appear in a panel at the bottom of the Atom window.

Alternative: Using Script Package

Another popular option is the "script" package, which also allows code execution ?

apm install script

With the script package, use Ctrl+Shift+B to run Python files. It provides similar functionality with additional language support.

Troubleshooting Common Issues

Issue Solution
Python not found Ensure Python is in your system PATH
Package not working Restart Atom after installing packages
No output panel Check if atom-runner is properly enabled in settings

Conclusion

Setting up Python in Atom is straightforward with the atom-runner package. This configuration allows you to write, execute, and debug Python code efficiently within a single environment, making it an excellent choice for Python development workflows.

Updated on: 2026-03-27T00:29:31+05:30

16K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements