Skip to content

Instantly share code, notes, and snippets.

@jimywork
Last active May 16, 2018 14:41
Show Gist options
  • Save jimywork/c90ac31afd05381668cd6a97f02706cf to your computer and use it in GitHub Desktop.
Save jimywork/c90ac31afd05381668cd6a97f02706cf to your computer and use it in GitHub Desktop.
Program dependency configuration file with pip
import pip
import os
import time
def install():
"""Installing as Program Dependencies"""
try:
with open("requirements.txt", "r") as requirements:
dependencies = requirements.read().splitlines()
except IOError:
print ("{}".format("requirements.txt not found, please redownload or do pull request again"))
exit()
for libs in dependencies:
try:
pip.main(["install", libs])
except Exception as e:
print("Unable to install %s using pip. Please read the instructions for \
manual installation.. Exiting" % (libs))
print("Error: %s" % e)
finally:
print("ready, finished {}".format(time.strftime("%H:%I on %A")))
if __name__== "__main__" :
install()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment