9 examples of 'print python version' in Python

Every line of 'print python version' 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
32def 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)
102def print_py_pkg_ver(pkgname, modulename=None):
103 if modulename is None:
104 modulename = pkgname
105 print
106 try:
107 import pkg_resources
108 out = str(pkg_resources.require(pkgname))
109 print pkgname + ': ' + foldlines(out)
110 except (ImportError, EnvironmentError):
111 sys.stderr.write("\nGot exception using 'pkg_resources' to get the version of %s. Exception follows.\n" % (pkgname,))
112 traceback.print_exc(file=sys.stderr)
113 sys.stderr.flush()
114 pass
115 except pkg_resources.DistributionNotFound:
116 print pkgname + ': DistributionNotFound'
117 pass
118 try:
119 __import__(modulename)
120 except ImportError:
121 pass
122 else:
123 modobj = sys.modules.get(modulename)
124 print pkgname + ' module: ' + str(modobj)
125 try:
126 print pkgname + ' __version__: ' + str(modobj.__version__)
127 except AttributeError:
128 pass
46def version(verbose=False):
47 """
48 Returns the version string for this BE installation. If
49 verbose==True, the string will include extra lines with more
50 detail (e.g. last committer's name, etc.).
51 """
52 if "_VERSION" in globals():
53 string = _VERSION
54 else:
55 string = version_info['revision']
56 if verbose == True:
57 info = copy.copy(version_info)
58 info['storage'] = libbe.storage.STORAGE_VERSION
59 string += ("\n"
60 "revision: %(revision)s\n"
61 "date: %(date)s\n"
62 "committer: %(committer)s\n"
63 "storage version: %(storage)s"
64 % info)
65 return string
27def show_version():
28 print('Mamba Sql Tools v{}'.format(version.short()))
29 print('{}'.format(copyright.copyright))
146@staticmethod
147def python_version():
148 """
149 :return: python version object
150 """
151 import sys
152 # version.major, version.minor, version.micro
153 return sys.version_info
74def version():
75 # json.dump(BUILD_METADATA, sys.stdout, sort_keys=True, indent=2)
76 for k in sorted(BUILD_METADATA):
77 print(k + '=' + BUILD_METADATA[k])
228def version():
229 import pkg_resources
230 version = pkg_resources.require("wrfy")[0].version
231 print('''\
232wrfy, version %s
233
234Copyright © 2016 Grahame Bowland
235License GPLv3+: GNU GPL version 3 or later .
236This is free software: you are free to change and redistribute it.
237There is NO WARRANTY, to the extent permitted by law.''' % (version))
238 sys.exit(0)
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

Related snippets