We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cace904 commit f67e11fCopy full SHA for f67e11f
check_python_version
@@ -0,0 +1,24 @@
1
+/// Use sys.version_info to check running python version
2
+def check_python():
3
+ import sys
4
+ info = sys.version_info
5
+ ver_major = info.major
6
+ ver_micro = info.micro
7
+ ver_minor = info.minor
8
+ ver_release = info.releaselevel
9
+ ver_serial = info.serial
10
+ if(ver_major not in [2,3]):
11
+ print('Not python2 or python3,Please have a check!')
12
+ sys.exit(1)
13
+ if ver_major == 2:
14
+ if ver_micro < 6:
15
+ print('Python 2.6+ required,Please update your python version')
16
17
+ if ver_major == 3:
18
+ if ver_micro < 3:
19
+ print('Python 3.3+ required,Please update your python version')
20
21
+ print('Running python version info: \n'+info.__repr__())
22
+
23
+if __name__ == '__main__':
24
+ check_python()
0 commit comments