使用pyqt完成窗体界面很方便,但是打包成exe之后会有问题,在网上找到解决办法如下:

Another Solution to the same problem:

 from distutils.core import setup
import py2exe
setup(windows=[{"script":"main.py"}], options={"py2exe":{"includes":["sip"]}})

I found that on the web, unfortunately don't know anymore where, but it also works for me!

Obviously is the second part only a way to get the " --includes sip" parameter directly into the script, but the use of "windows" instead of "console" doesn't open a console window, but immediately a Qt window in my case.

Fix for PyQt4

If you get the following error:

ImportError: No module named _qt

The solution is to add PyQt4._qt to the setup function (see bellow). I found the solution for the problem here.

 from distutils.core import setup
import py2exe setup(windows=[{"script" : "app.pyw"}], options={"py2exe" : {"includes" : ["sip","PyQt4._qt"]}})
或者我们直接在源代码中加入:
import sip  #程序打包需要
import  decimal #程序打包需要
也是可以的。

用py2exe打包pyqt4出现的问题(转)的更多相关文章

  1. PyQt4 py2exe 打包 HardwareManager

    #!/usr/bin/env python # -*- coding: UTF-8 -*- # 1. 以下代码保存在HardwareManager项目的目录下,名称叫:setup.py: # 2. 打 ...

  2. 使用py2exe打包你的py程序

    软件环境:python3.3.4 + PyQt5 使用py2exe打包写好的py文件,过程如下: 在你要打包的代码文件(比如sample.py)的同文件夹建立一个python代码文件(比如setup. ...

  3. py2exe打包遇到的问题

    py2exe打包python成.exe文件 打包过程和结果 1.创建setup脚本打包文件,其中设置打包的属性和方法.注意:尽量将被打包文件和此打包脚本放在同目录下(因为在尝试非同目录下时,出现了非可 ...

  4. py2exe 打包scipy时遇到的问题

    最近写了个小程序,用PyQt5做的界面,写完之后用py2exe打包成独立的exe文件,运行正常. 后来由于需要,调用SciPy.io.loadmat,改写setup.py,打包之后运行错误,提示: T ...

  5. python+pygame游戏开发之使用Py2exe打包游戏

    最近在用python+pygame 开发游戏,写完以后在分享给朋友玩的时候遇到了很大的问题,只有搭建了环境才能运行python脚本. 这会吓退99%以上的人……所以把我们的游戏打包(注意是打包而不是编 ...

  6. [python学习笔记] py2exe 打包

    遇坑 之前经过折腾,pyinstaller打包文件可以在别的windows7上运行.但是,mfk, 客户说是xp系统.崩溃 使用pyinstaller各种折腾,打包出来的依然是不是有效的win32程序 ...

  7. 通过py2exe打包python程序的过程中,解决的一系列问题

    py2exe的使用方法参考<py2exe使用方法>. 注:程序可以在解释器中正常运行,一切问题都出在打包过程中. 问题1: 现象:RuntimeError: maximum recursi ...

  8. py2exe打包OpenCV,找不到libiomp5md.dll

    问题:py2exe打包OpenCV,找不到libiomp5md.dll 解决方法:把 libiomp5md.dll 从numpy/core/ 里面复制到 python27/DLLS/文件夹!!!

  9. 用py2exe打包成一个exe文件

    用py2exe打包成一个exe文件 http://blog.csdn.net/franktan2010/article/details/46514607

随机推荐

  1. 【SICP练习】150 练习4.6

    练习4-6 原版的 Exercise 4.6. Let expressions are derived expressions, because (let (( ) - ( )) ) is equiv ...

  2. EasyUI基础入门之Resiable(可缩放)

    easyui的base插件学习已经进行到Resizable(可缩放)了.照旧看看easyui官网的API. Resiable 正如其字面意思一样(可伸缩),resiable主要是将一些html元素扩展 ...

  3. 在Eclipse下导入vlc-android并编译

    在Ubuntu14.04下载好了VLC的源代码后,VLC的Eclipseproject存放在"vlc-android"文件夹 root@dzt-VirtualBox:/home/d ...

  4. hdu 4472 dp

    http://acm.hdu.edu.cn/showproblem.php? pid=4472 第一个本能的找规律.第二直觉 树被分成的子树,然后,复发或DP 然后发现不.然后,他们发现,他们并没有阅 ...

  5. IOS开发-Swift新语言初见

    Safe Swift pairs increased type safety with type inference, restricts direct access to pointers, and ...

  6. java中HashSet详解

    HashSet 的实现 对于 HashSet 而言,它是基于 HashMap 实现的,HashSet 底层采用 HashMap 来保存所有元素,因此 HashSet 的实现比较简单,查看 HashSe ...

  7. 【Android平台安全方案】の #00-请不要在外部存储(SD卡)加密存储的敏感信息

    本文翻译自https://www.securecoding.cert.org/confluence/display/java/DRD00-J.+Do+not+store+sensitive+infor ...

  8. 关于session_start()这个问题

    关于session_start()这个问题,其实网上很多解决的方法,论坛也好多人回答这类的问题, 现在的状况是依然有警告提示Warning: session_start() [function.ses ...

  9. 思维方式--SMART原则

    假设你的项目管理.系统架构的兴趣,请加微信订阅号"softjg",收藏此PM.建筑师的家 万事开头于你目标的设定,假设開始走错了,那么后面的路将会更加的错误.甚至于更加的努力犯错就 ...

  10. 小猪Android越来越方式 Day 5 - part 2

    小猪的Android入门之路 Day 5 - part 2 Activity片段:Fragment(碎片)                                  ------转载请注明出处 ...