Mercurial > hg > config
view python/example/install_and_exec.py @ 780:c1ab43edf296
https://docs.python.org/3.1/distutils/uploading.html#pypi-package-display
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 23 Aug 2016 15:01:41 -0700 |
parents | 9cb40c01c10a |
children |
line wrap: on
line source
#!/usr/bin/env python # -*- coding: utf-8 -*- """ illustrates installation and execution following installation """ import os import subprocess import sys here = os.path.dirname(os.path.realpath(__file__)) try: import gnupg print ("gnupg installed") except ImportError: print ("gnupg not installed") subprocess.check_call(['pip', 'install', 'gnupg']) args = [sys.executable] + sys.argv os.execl(sys.executable, *args)