Created
May 9, 2021 20:02
-
-
Save Justaus3r/76ecbcfabe083b3194a44360ba0c00cf to your computer and use it in GitHub Desktop.
Check for specific python modules
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
# 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