python生成可执行exe

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/guanyuqiu/article/details/80922098

1,打2015 补丁

然后,在线安装 matplotlib , opencv-python, scikit-earn, pyinstaller

例如,pip install matplotlib, pip install opencv-python,

pip install scikit-learn

pip install pyinstaller

编译分两步

第一,pyinstaller -F  x.py , 会在同目录下产生x.spec 文件;

第二,等第一步结束后,打开x.spec文件,将其中的  datas, 和hiddenimports替换为:          

             datas=[('model\\','model')],

             hiddenimports=['scipy._lib.messagestream', 'sklearn.neighbors.typedefs'],

然后,运行 pyinstaller -F x.spec

最终生成的exe 在dist下面,拿出来放到x.py同目录下,即可运行

猜你喜欢

转载自blog.csdn.net/guanyuqiu/article/details/80922098