INNER CODE UNIT · Python
run_checks
stefmolin/Hands-On-Data-Analysis-with-Pandas-2nd-edition · ch_01/check_environment.py:14
def run_checks(raise_exc=False):
"""
Check that the packages we need are installed and the Python version is good.
Parameters
----------
raise_exc : bool, default ``False``
Whether to raise an exception if any of the packages doesn't
match the requirements (used for GitHub Action).
"""
failures = []
# check the python version
print('Using Python in %s:' % sys.prefix)
if Version(sys.version) >= '3.7.1' and Version(sys.version) < '3.10.0':
print(OK, 'Python is version %s\n' % sys.version)
else:
print(FAIL, 'Python version >= 3.7.1 and < 3.10.0 is required, but %s is installed.\n' % sys.version)