Last active
May 16, 2018 14:41
-
-
Save jimywork/c90ac31afd05381668cd6a97f02706cf to your computer and use it in GitHub Desktop.
Program dependency configuration file with pip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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