Python Forum

Full Version: Checking whether program is installed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys,

Is there an option to check with python script whether program is installed on computer or not? And give feedback in form of messagebox?

Thanks in advance!
Untested but should work:

from pathlib import Path
import os

def check_file_exists(filename)       
    fullname = os.path.abspath(filename)
    if fullname.is_file():
        return True
    return False
If the program was installed using the standard system installer/package manager then you can likely ask said manager (but this is of course system-dependent...). Otherwise all you can do if see if you can find the executable at some expected places (or scan the whole disk for it) but that won't always mean it is installed/usable.