Created
September 26, 2022 10:47
-
-
Save amrakm/9fb7d6b19ea5f5398b2ebb7a9ef9ca30 to your computer and use it in GitHub Desktop.
import or install dependencies from within python
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 | |
def import_or_install(package): | |
try: | |
__import__(package) | |
except ImportError: | |
pip.main(["install", package]) | |
import_or_install("smdebug") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment