├── README.md ├── get_pip.py ├── install_requirements.py └── requirements.txt /README.md: -------------------------------------------------------------------------------- 1 | # Python-Package-Installer 2 | A python package installer that will install all required packages from code into the python interpreter it was run in. Useful for releasing unpackaged code. 3 | 4 | # Intructions 5 | Simply place all of the python packages you would like installed inside of *requirements.txt* 6 | 7 | When you'd like to install them you can run *install_requirements.py* or import the module: 8 | ```python 9 | import install_requirements 10 | ``` 11 | 12 | 13 | # 💻 Launch Your Software Development Career Today! 14 | 15 | 🎓 **No degree? No problem!** My program equips you with everything you need to break into tech and land an entry-level software development role. 16 | 17 | 🚀 **Why Join?** 18 | - 💼 **$70k+ starting salary potential** 19 | - 🕐 **Self-paced:** Complete on your own time 20 | - 🤑 **Affordable:** Low risk compared to expensive bootcamps or degrees 21 | - 🎯 **45,000+ job openings** in the market 22 | 23 | 👉 **[Start your journey today!](https://techwithtim.net/dev)** 24 | No experience needed—just your determination. Future-proof your career and unlock six-figure potential like many of our students have! 25 | -------------------------------------------------------------------------------- /install_requirements.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import sys 3 | import get_pip 4 | import os 5 | import importlib 6 | import contextlib 7 | 8 | def install(package): 9 | ''' 10 | installs a package using pip 11 | 12 | :param package: string 13 | ''' 14 | subprocess.call([sys.executable, "-m", "pip", "install", package]) 15 | 16 | 17 | required = [] 18 | failed = [] 19 | 20 | # Try to open reqirements.txt file and read all required packages 21 | try: 22 | file = open("requirements.txt", "r") 23 | file_lines = file.readlines() 24 | required = [line.strip().lower() for line in file_lines] 25 | file.close() 26 | except FileNotFoundError: 27 | print("[ERROR] No requiremnts.txt file found") 28 | 29 | 30 | if len(required) > 0: 31 | print("[INPUT] You are about to install", len(required), "packages, would you like to proceed (y/n):", end=" ") 32 | ans = input() 33 | 34 | if ans.lower() == "y": 35 | for package in required: 36 | try: 37 | print("[LOG] Looking for", package) 38 | with contextlib.redirect_stdout(None): 39 | __import__(package) 40 | print("[LOG]", package, "is already installed, skipping...") 41 | except ImportError: 42 | print("[LOG]", package, "not installed") 43 | 44 | try: 45 | print("[LOG] Trying to install", package, "via pip") 46 | try: 47 | import pip 48 | except: 49 | print("[EXCEPTION] Pip is not installed") 50 | print("[LOG] Trying to install pip") 51 | get_pip.main() 52 | print("[LOG] Pip has been installed") 53 | 54 | print("[LOG] Installing", package) 55 | install(package) 56 | with contextlib.redirect_stdout(None): 57 | __import__(package) 58 | print("[LOG]", package, "has been installed") 59 | except Exception as e: 60 | print("[ERROR] Could not install", package, "-", e) 61 | failed.append(package) 62 | 63 | else: 64 | print("[STOP] Operation terminated by user") 65 | else: 66 | print("[LOG] No packages to install") 67 | 68 | if len(failed) > 0: 69 | print("[FAILED]", len(failed), "package(s) were not installed. Failed package install(s):", end=" ") 70 | for x, package in enumerate(failed): 71 | if x != len(failed) -1: 72 | print(package, end=",") 73 | else: 74 | print(package) 75 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | tensorflow 2 | keras 3 | numpy 4 | matplotlib 5 | pygame 6 | --------------------------------------------------------------------------------