简体   繁体   English

如何为python 3.5+构建.exe,3.6如果可能的话?

[英]how to build .exe for python 3.5+, 3.6 if possible?

Is there now an easy protocol to build a .exe from python 3.5+, using modules pyqtgraph, qt5, theano, pymc3, numpy, scipy, os and sys, and opening a simple GUI stored in a '.ui' file ? 现在有一个简单的协议从python 3.5+构建.exe,使用模块pyqtgraph,qt5,theano,pymc3,numpy,scipy,os和sys,并打开一个存储在'.ui'文件中的简单GUI? I lost hours and eventually failed to make one (for w7-64 bits). 我失去了几个小时,最终没能成功(为w7-64位)。 Help ! 救命 !

preliminary failure with py2exe: I first install py2exe for python 3 but it turns out this is not compatible with my python 3.6 yet, so I downgraded to python 3.5… to get a bunch of errors. 使用py2exe初步失败:我首先为python 3安装了py2exe,但事实证明这与我的python 3.6不兼容,所以我降级为python 3.5 ......以获得一堆错误。 Then I went to forums and tried the proposed cures but failed (I'm uneasy with windows), the alternative being to downgrade to python 3.4… So I downgraded to python 3.4 to get an error concerning a missing 'msvcr100.dll' that I tried to install following instructions on forums but by default I don't have the permission to modify system directories… When I eventually had this permission it turns out the 'regsvr32' command fails (isn't this for 32 bits ? but there is no 'regsvr64'…). 然后我去了论坛并尝试了提议的治疗但失败了(我对Windows感到不安),另一种方法是降级到python 3.4 ...所以我降级到python 3.4以获得有关缺少'msvcr100.dll'的错误尝试在论坛上安装以下说明,但默认情况下我没有修改系统目录的权限......当我最终获得此权限时,结果是'regsvr32'命令失败(这不是32位吗?但是没有'regsvr64' ......)。 Following episodes are described below. 以下剧集如下所述。


update august 23, 2017, 1pm: 2017年8月23日下午1点更新:

what's next ? 下一步是什么 ?


update september, 2, 2pm: 更新9月2日,下午2点:

I eventually managed to build a .exe with pyinstaller after many episodes. 我最终设法在许多剧集之后用pyinstaller构建一个.exe。

Unfortunately I failed to deal with the 'theano' module (that is required in my case by the 'pymc3' module) and I had to modify the .py files and give up part of the application. 不幸的是我没有处理'theano'模块(在我的情况下由'pymc3'模块需要),我不得不修改.py文件并放弃部分应用程序。 Could anyone help me building a .exe for windows 7+, with the 'theano' module ? 任何人都可以帮助我使用'theano'模块为Windows 7+构建.exe吗?

see build a .exe for Windows from a python 3 script importing theano with pyinstaller 请参阅使用pyinstaller导入theano的python 3脚本为Windows构建.exe

I would suggest pyinstaller see http://www.pyinstaller.org/ 我建议pyinstaller见http://www.pyinstaller.org/

The pyinstaller already supports 3.5 pyinstaller已经支持3.5

The development version supports 3.6 开发版支持3.6

Pyinstaller Works with Python 3.5 and it is working even for packages like tensor-flow, scipy , etc (The packages I worked with) Pyinstaller与Python 3.5一起工作,它甚至可用于tensor-flow,scipy等软件包(我使用过的软件包)

py -3.5 pip install pyinstaller

then go the C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python35\\Scripts and run the command 然后转到C:\\ Users \\ user \\ AppData \\ Local \\ Programs \\ Python \\ Python35 \\ Scripts并运行命令

pyinstaller <code .py file along with directory> --onefile

--onefile : is for compressing the build and get a single file as output --onefile:用于压缩构建并获取单个文件作为输出

It is better to use spec file to import other hidden libraries. 最好使用spec文件导入其他隐藏库。 I listed all Sklearn libraries and add them to spec file as a hiddenimports , you can add libraries you used in your project. 我列出了所有Sklearn库并将它们作为hiddenimports添加到spec文件中 ,您可以添加在项目中使用的库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM