如何建立适用于python 3.5 +,3.6的.exe? [英] how to build .exe for python 3.5+, 3.6 if possible?

查看:105
本文介绍了如何建立适用于python 3.5 +,3.6的.exe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在是否有使用pyqtgraph,qt5,theano,pymc3,numpy,scipy,os和sys的模块从python 3.5+构建.exe的简单协议,并打开存储在'.ui'文件中的简单GUI ?我浪费了几个小时,最终没能做到(用w7-64位)。

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 ? I lost hours and eventually failed to make one (for w7-64 bits). Help !

py2exe的初步故障:我首先为python 3安装py2exe,但事实证明这与我的python 3.6不兼容,所以我降级为python 3.5…得到很多错误。然后我去了论坛,尝试了建议的解决方法,但是失败了(我对Windows感到不安),另一种选择是降级到python 3.4…所以我降级到python 3.4以获得关于我丢失的 msvcr100.dll的错误试图在论坛上安装以下说明,但是默认情况下我没有修改系统目录的权限...当我最终拥有此权限时,结果证明'regsvr32'命令失败(不是32位吗?但是没有'regsvr64'...)。以下情节描述如下。

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. 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’…). Following episodes are described below.

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

update august 23, 2017, 1pm:

  • I also tried pyinstaller as advised but it failed (see my related question build a .exe for Windows from a python 3 script importing theano with pyinstaller)


  • 我也尝试了cx_freeze,但失败了(请参阅我的相关问题使用python 3脚本为Windows构建.exe

    我也尝试了pynsist,但失败了(链接与上面相同)

    I also tried pynsist but it fails (same link than above)

    下一步是什么?

    9月2日下午2点更新:

    update september, 2, 2pm:

    我最终设法在许多情节之后用pyinstaller构建.exe。

    I eventually managed to build a .exe with pyinstaller after many episodes.

    Un幸运的是,我无法处理 theano模块(在我的情况下是 pymc3模块所必需的),因此我不得不修改.py文件并放弃了部分应用程序。有人可以帮我用'theano'模块为Windows 7+构建.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. Could anyone help me building a .exe for windows 7+, with the ‘theano’ module ?

    请参见通过pyinstaller导入theano的python 3脚本为Windows构建.exe。

    推荐答案

    Pyinstaller可与Python 3.5配合使用,甚至适用于诸如tensor-flow,scipy等软件包(

    Pyinstaller Works with Python 3.5 and it is working even for packages like tensor-flow, scipy , etc (The packages I worked with)

    py -3.5 pip install pyinstaller
    

    然后转到C:\Users\user\AppData\Local\Programs\Python\Python35\Scripts
    并运行命令

    then go the C:\Users\user\AppData\Local\Programs\Python\Python35\Scripts and run the command

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

    -onefile:用于压缩版本并获取单个文件作为输出

    --onefile : is for compressing the build and get a single file as output

    这篇关于如何建立适用于python 3.5 +,3.6的.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆