Created
March 16, 2020 16:58
-
-
Save tebeka/9c36d673e71201cd545e3477230d525f to your computer and use it in GitHub Desktop.
Check install
This file contains hidden or 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 importlib | |
| from sys import version_info | |
| if version_info[:2] < (3, 6): | |
| raise SystemExit('error: Python 3.6+ required') | |
| missing = [] | |
| pkgs = ( | |
| ('jupyterlab', 'jupyterlab'), | |
| ('matplotlib', 'matplotlib'), | |
| ('pandas', 'pandas'), | |
| ('sklearn', 'scikit-learn'), | |
| ) | |
| for mod, pkg in pkgs: | |
| try: | |
| importlib.import_module(mod) | |
| except ImportError: | |
| missing.append(pkg) | |
| if not missing: | |
| print('You have all the requirement') | |
| raise SystemExit() | |
| missing = ', '.join(sorted(missing)) | |
| print('error: you are missing the following modules - {}'.format(missing)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment