4 examples of 'how to check python version in jupyter notebook' in Python

Every line of 'how to check python version in jupyter notebook' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
282def check_python_version():
283 if sys.version_info < (3, 5):
284 stderr.write("DistAlgo requires Python version 3.5 or newer.\n")
285 return False
286 else:
287 return True
18def check_python(version):
19 required_version = tuple(int(i) for i in version.split('.'))
20 actual_version = sys.version_info[:2]
21
22 assert actual_version >= required_version, (
23 'Must use at least Python %s but have version %d.%d' %
24 (version, actual_version[0], actual_version[1]))
62def _in_ipynb():
63 """Check if we are running in a Jupyter Notebook
64
65 Credit to https://stackoverflow.com/a/24937408/3996580
66 """
67 __VALID_NOTEBOOKS = ["",
68 ""]
69 try:
70 return str(type(get_ipython())) in __VALID_NOTEBOOKS
71 except NameError:
72 return False
53@nox.session(python=PYTHON_VERSIONS)
54def test_jupyter_notebook(session):
55 if session.python not in DEFAULT_PYTHON_VERSIONS:
56 session.skip(
57 "Not testing Jupyter notebook on Python {}, supports [{}]".format(
58 session.python, ",".join(DEFAULT_PYTHON_VERSIONS)
59 )
60 )
61 deps(session)
62 session.install("jupyter", "nbval")
63 session.run("pytest", "--nbval", "docs/notebook/Tutorial.ipynb", silent=True)

Related snippets