Every line of 'check python version in jupyter' 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.
282 def 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
18 def 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]))
8 def checkPython(context): 9 context.Message("Check for python..") 10 context.Result(0) 11 return False
17 def check_py(): 18 19 if os_system() == "Windows": 20 try: 21 py_ver = subprocess.check_output( 22 "py -3 -V").decode('UTF-8').splitlines()[0] 23 print("Script has detected " + py_ver + 24 " version present on the machine.") 25 except: 26 print("Script could not detect Python 3 on the machine.\n" 27 "Go to https://www.python.org/downloads/ page and download latest Python 3 version.") 28 else: 29 try: 30 py_ver = subprocess.check_output(["python3", "-V"]).decode('UTF-8').splitlines()[0] 31 print("Script detected " + py_ver + 32 " version present on the machine.") 33 except: 34 print("Script could not detect Python 3 on the machine.\n" 35 "Go to https://www.python.org/downloads/ page and download latest Python 3 version.")
33 def check_for_zmq(minimum_version, required_by='Someone'): 34 try: 35 import zmq 36 except ImportError: 37 raise ImportError("%s requires pyzmq >= %s" % 38 (required_by, minimum_version)) 39 40 patch_pyzmq() 41 42 pyzmq_version = zmq.__version__ 43 44 if not check_version(pyzmq_version, minimum_version): 45 raise ImportError("%s requires pyzmq >= %s, but you have %s" % ( 46 required_by, minimum_version, pyzmq_version))
16 @staticmethod 17 def python_is_version(version=None): 18 if re.search('^'+str(version)+'\.\d+\.\d+', str(Version.python()), re.M | re.I) is None: 19 return False 20 return True
32 def python_version() -> None: 33 """ 34 Check that the Python version is supported 35 """ 36 py_version = sys.version.split()[0] 37 if py_version < "3.5": 38 print(error_message(), "Unsupported Python version") 39 sys.exit(1)
43 def check_pyinstaller_version(): 44 """Using is_module_satisfies() for pyinstaller fails when 45 installed using 'pip install develop.zip' command 46 (PyInstaller Issue #2802).""" 47 # Example version string for dev version of pyinstaller: 48 # > 3.3.dev0+g5dc9557c 49 version = PyInstaller.__version__ 50 match = re.search(r"^\d+\.\d+(\.\d+)?", version) 51 if not (match.group(0) >= PYINSTALLER_MIN_VERSION): 52 raise SystemExit("Error: pyinstaller %s or higher is required" % PYINSTALLER_MIN_VERSION)
31 @pytest.mark.parametrize("version_info", ((1,), (4, 6), (5, 8, 900))) 32 def test_check_pyqt_version(capsys, monkeypatch, version_info): 33 """Tests to ensure exit and error message on too low PyQt version.""" 34 monkeypatch.setattr(checkversion, "PYQT_VERSION", version_info) 35 36 with pytest.raises(SystemExit, match=str(checkversion.ERR_CODE)): 37 checkversion.check_pyqt_version() 38 39 expected = build_message("PyQt", checkversion.PYQT_REQUIRED_VERSION, version_info) 40 captured = capsys.readouterr() 41 assert captured.err == expected