Created
October 14, 2017 09:54
-
-
Save rustoceans/5ab0f3bf718e9282ae09f981fc963cd8 to your computer and use it in GitHub Desktop.
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
def install_and_import(package): | |
import importlib | |
try: | |
importlib.import_module(package) | |
except ImportError: | |
import pip | |
pip.main(['install', package]) | |
finally: | |
globals()[package] = importlib.import_module(package) | |
install_and_import('transliterate') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment