Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Justaus3r/76ecbcfabe083b3194a44360ba0c00cf to your computer and use it in GitHub Desktop.
Save Justaus3r/76ecbcfabe083b3194a44360ba0c00cf to your computer and use it in GitHub Desktop.
Check for specific python modules
# Will only work for external modules
import pkg_resources
module_list = []
def check_module(Module):
for module in pkg_resources.working_set:
module_list.append(str(module).split()[0])
if Module not in module_list:
print(f"{Module} Module not found\n install it using 'pip install {Module}'")
else:
print(f'{Module} Module is installed on your System')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment