5 examples of 'check library version python' in Python

Every line of 'check library version python' 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
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]))
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
17def 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.")
23def main():
24 pyVersion = sys.version_info
25 # print('python version: ' + str(pyVersion[0]) + '.' + str(
26 # pyVersion[1]) + '.' + str(pyVersion[2]))
27 check_libraries()
28 print(global_results)
43def 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)

Related snippets