Created
November 26, 2021 09:20
-
-
Save sehrishnaz/2f7ead70f1ab8927325f5f14a747c000 to your computer and use it in GitHub Desktop.
Install Python Packages on Installation of Odoo Modules
This file contains hidden or 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
class Install_Packages: | |
""" | |
This Class installs required Packages or library | |
""" | |
get_pckg = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze']) | |
installed_packages = [r.decode().split('==')[0] for r in get_pckg.split()] | |
# List of your required packages | |
required_packages = ['packages_1', 'packages_2', 'packages_3', 'packages_4'] | |
for packg in required_packages: | |
if packg in installed_packages: | |
pass | |
else: | |
print('installing package %s' % packg) | |
os.system('pip3 install ' + packg) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install Python Packages on Installation of Odoo Modules