-
Notifications
You must be signed in to change notification settings - Fork 0
/
HowTo.txt
99 lines (71 loc) · 3.17 KB
/
HowTo.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
How to build compile python2 executable in CentOS7
Sample python script
[root@k8s-master python]# cat > example1.py << "#EOF"
import sys
import os
def mainProgram():
print("This is a test")
if __name__ == "__main__":
mainProgram()
#EOF
[root@k8s-master python]#
[root@k8s-master python]# python example1.py
This is a test
[root@k8s-master python]#
Install pyinstaller
PyInstaller for python2
https://pypi.org/project/pyinstaller/2.0/#files
Download pyinstaller 2.0
wget https://files.pythonhosted.org/packages/ec/a3/dc7bc8c48a873c3156866df709a23078a6dda86db88328df5cf639385527/pyinstaller-2.0.tar.bz2
bunzip2 pyinstaller-2.0.tar.bz2
tar xvf pyinstaller-2.0.tar
cd pyinstaller-2.0/
[root@buildserver pyinstaller-2.0]#
[root@buildserver pyinstaller-2.0]# ll
total 48
drwxr-xr-x. 8 admin admin 4096 Aug 8 2012 buildtests
drwxr-xr-x. 5 admin admin 4096 Aug 8 2012 doc
drwxr-xr-x. 4 admin admin 31 Aug 8 2012 e2etests
drwxr-xr-x. 2 admin admin 4096 Aug 8 2012 examples
-rw-r--r--. 1 root root 45 May 7 02:48 howto.txt
-rw-r--r--. 1 admin admin 18 Aug 8 2012 MANIFEST.in
drwxr-xr-x. 8 admin admin 4096 Aug 8 2012 PyInstaller
-rwxr-xr-x. 1 admin admin 3244 Aug 8 2012 pyinstaller-gui.py
-rwxr-xr-x. 1 admin admin 2718 Aug 8 2012 pyinstaller.py
-rw-r--r--. 1 admin admin 1741 Aug 8 2012 README.rst
-rw-r--r--. 1 admin admin 3778 Aug 8 2012 setup.py
drwxr-xr-x. 8 admin admin 4096 Aug 8 2012 source
drwxr-xr-x. 4 admin admin 101 Aug 8 2012 support
drwxr-xr-x. 2 admin admin 4096 Aug 8 2012 utils
[root@buildserver pyinstaller-2.0]#
#### python pyinstaller.py /path/to/yourscript.py
Verify pyinstaller working
[root@buildserver pyinstaller-2.0]# ./pyinstaller.py -D -F -n example1 -c example1.py
10 INFO: wrote /root/pyinstaller-2.0/example1/example1.spec
43 INFO: UPX is not available.
1467 INFO: checking Analysis
1468 INFO: building Analysis because out00-Analysis.toc non existent
1468 INFO: running Analysis out00-Analysis.toc
1490 INFO: Analyzing /root/pyinstaller-2.0/support/_pyi_bootstrap.py
2837 INFO: Analyzing /root/pyinstaller-2.0/PyInstaller/loader/archive.py
2898 INFO: Analyzing /root/pyinstaller-2.0/PyInstaller/loader/carchive.py
2954 INFO: Analyzing /root/pyinstaller-2.0/PyInstaller/loader/iu.py
2977 INFO: Analyzing example1.py
3024 INFO: Hidden import 'encodings' has been found otherwise
3024 INFO: Looking for run-time hooks
3024 INFO: Analyzing rthook /root/pyinstaller-2.0/support/rthooks/pyi_rth_encodings.py
3393 INFO: Warnings written to /root/pyinstaller-2.0/example1/build/pyi.linux2/example1/warnexample1.txt
3397 INFO: checking PYZ
3397 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing
3397 INFO: building PYZ out00-PYZ.toc
4000 INFO: checking PKG
4000 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
4000 INFO: building PKG out00-PKG.pkg
6171 INFO: checking EXE
6171 INFO: rebuilding out00-EXE.toc because example1 missing
6171 INFO: building EXE from out00-EXE.toc
6171 INFO: Appending archive to EXE /root/pyinstaller-2.0/example1/dist/example1
[root@buildserver pyinstaller-2.0]#
[root@buildserver dist]# /root/pyinstaller-2.0/example1/dist/example1
This is a test
[root@buildserver dist]#