python path get code example Example: find python path windows >>> import os >>> import sys >>> os.path.dirname(sys.executable) 'C:\\Python25'