py2exe ImportError: No module named sip
来源:互联网 发布:众金在线网络借贷 编辑:程序博客网 时间:2024/05/17 04:01
Error message
File "form1.pyc", line 11, in ? File "qt.pyc", line 9, in ? File "qt.pyc", line 7, in __loadImportError: No module named sip
Solution
python setup.py py2exe --includes sip
setup.py
1 from py2exe.build_exe import py2exe 2 from distutils.core import setup 3 setup( console=[{"script": "main.py"}] )
Reference
I found this tips here : http://nerdierthanthou.nfshost.com/2005/03/image-resizer.html
There is a full code sample.
Another Solution to the same problem:
from distutils.core import setupimport py2exesetup(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.
1 from distutils.core import setup 2 import py2exe 3 4 setup(windows=[{"script" : "app.pyw"}], options={"py2exe" : {"includes" : ["sip", "PyQt4._qt"]}})
Using PyQt4 with Databases
When deploying applications which use PyQt4 and SQLite:
Add "PyQt4.QtSql' to the setup includes.
Copy the contents of PyQt4\plugins\sqldrivers to <appdir>\sqldrivers. It did not work for me in any subdirectory including the zipfile directory. For SQLite I only needed to copy qsqlite4.dll.
- A separate copy of sqlite3.dll is not needed.
- py2exe ImportError: No module named sip
- py2exe error: "ImportError: No module named httplib"
- ImportError: No module named ...
- ImportError: No module named ***
- ImportError:No module named
- ImportError: No module named
- ImportError: No module named ×××××
- 如何使用py2exe,以及解决ImportError: No module named py2exe问题
- py2exe ImportError: No module named iterators,ImportError: MemoryLoadLibrary failed loading win32ap
- ImportError: No module named vtkCommonPython
- ImportError: No module named win32api
- ImportError: No module named tagging_autocomplete
- ImportError: No module named flask_babelex
- ImportError: No module named XXXX
- ImportError: No module named pylab
- ImportError: No module named 'psycopg2'
- ImportError: No module named visa
- ImportError: No module named memcache
- [Accelerated c++读书笔记]统计单词出现的行号
- 内核模式下的字符串操作
- 【Linux】Ubuntu 代理配置
- 第12周实验报告1(1000以内的所有完数 )
- 入行十多年的电子工程师对研发工作的一点感悟 V1.1
- py2exe ImportError: No module named sip
- Linux内核代码风格
- 第12周报告2
- 第12周实验报告2(修改版)
- 第12周实验报告3
- 熟练地说出这些句子,高中英语都是浮云
- 第13周实验报告1
- 从电子工程师到研发经理到老板的多面人生
- 招商网上银行接口(自己的网上银行)