I want to check if a module exists, if it doesn\'t I want to install it.
How should I do this?
So far I have this code which correctly prints f
f
import pip def import_or_install(package): try: __import__(package) except ImportError: pip.main(['install', package])
This code simply attempt to import a package, where package is of type str, and if it is unable to, calls pip and attempt to install it from there.