26 lines
547 B
Python
Executable File
26 lines
547 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import argparse
|
|
import os
|
|
import sys
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--base",
|
|
action="store_true",
|
|
help="print Python base prefix")
|
|
args = parser.parse_args()
|
|
|
|
prefix = get_python_prefix(base=args.base)
|
|
sys.stdout.write(prefix + '\n')
|
|
|
|
|
|
def get_python_prefix(base=False):
|
|
prefix = base and getattr(sys, 'base_prefix', None) or sys.prefix
|
|
return os.path.realpath(prefix)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|