樹心幽徑

« 20191014在windows7安裝並使用python3.7.4來剖析數字序列字串 | Main | 20191021用python執行k近鄰分類、k-平均聚類、標註傳播 »

20191018用python的pip模組裝pyinstaller用以製作windows系統下的可執行檔(EXE)
2019/10/18,08:57

(1)請參考連結文章:將Python打包成exe檔

(2) 在命令列輸入 pip install pyinstaller

(3-1)在記事本編寫 6.py

# -*- coding: UTF-8 -*-
import numpy as np
maxno=30
ds=input("請輸1~29間的數字序列(以空白隔開)=")
bs=(' '.join(ds.split())).split(' ')

cs = []
for i in range(len(bs)):
   cs.append(int(bs[i]))

print(sorted(cs),"項目數=",len(cs))

na=np.arange(maxno)
for i in range(maxno):
   na[i]=0
 
for i in cs:
    if i < maxno :
        na[i]=i;


for i in range(1,maxno):
   print(na[i],end=',')

print()

(3-2)在命令列輸入 pyinstaller -F .\6.py
:

20358 INFO: Appending archive to EXE D:\dist\6.exe
20373 INFO: Building EXE from EXE-00.toc completed successfully.

(4)dir d:\dist
:

2019/10/17  下午 02:28        19,439,208 6.exe
:

(5) 執行 D:\dist\6.exe
請輸1~29間的數字序列(以空白隔開)=67 88 99 12   3 4
[3, 4, 12, 67, 88, 99] 項目數= 6
0,0,3,4,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,


迴響

 
Accessible and Valid XHTML 1.0 Strict and CSS Powered by LifeType