Py2Exe,Sqlite - 不是有效的Win 32应用程序 [英] Py2Exe, Sqlite - Not a valid Win 32 Application

查看:633
本文介绍了Py2Exe,Sqlite - 不是有效的Win 32应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Python程序,我试图使用Py2Exe打包。我使用的是Python 3.4。我的程序使用Sqlachemy和Sqlite3来创建和访问数据库。



当我从Py2Exe安装结果文件时,我收到了dll错误:


Sqlite不是一个有效的Win32应用程序


我试图通过这里列出的各种解决方法,包括卸载python和re安装所有模块以确保我只有32位版本。任何想法?



我的setup.py代码如下所列。它使用了sqlite中列出的一些工作,以及sqlalchemy的一个数字

  from distutils.core import setup 
import py2exe

setup(console = ['notetest.py'],
options = {'py2exe':{'packages':[
'reportlab',
'reportlab.graphics.charts',
'reportlab.graphics.samples',
'reportlab.graphics.widgets',
'reportlab.graphics.barcode',
'reportlab.graphics',
'reportlab.lib',
'reportlab.pdfbase',
'reportlab.pdfgen',
'reportlab.platypus',
'sqlalchemy.dialects.sqlite',
#'sqlalchemy.databases.sqlite',
'sqlite3'
]}})


解决方案

好的,我不知道这是否是一个真正的有效的工作,但它的工作原理相当简单。



我从 Sqlite 下载了最新的Sqlite dll 。我只是用这个更新的文件替换了Py2Exe生成的Sqlite dll,程序运行正常。



我也使用InnoSetup来编译MSI安装程序,所以可以简单地将较新的dll复制到预编译目录中,以便包含在MSI安装程序中。



这对我有用希望它能帮助别人。


I have a Python program that I am attempting to package using Py2Exe. I am using Python 3.4. My program uses Sqlachemy and Sqlite3 in order to create and access the database.

When I install the resulting files from Py2Exe I get the dll error:

Sqlite is not a valid Win32 application

I have attempted to go through the various work-arounds listed here, including uninstall python and re-installing all modules to ensure that I have only the 32 bit versions. Any ideas?

My setup.py code is listed below. It uses some of the work arounds listed for sqlite, as well as a number for sqlalchemy

from distutils.core import setup
import py2exe

setup(console = ['notetest.py'], 
    options = {'py2exe' : {'packages' : [
    'reportlab',
    'reportlab.graphics.charts',
    'reportlab.graphics.samples',
    'reportlab.graphics.widgets',
    'reportlab.graphics.barcode',
    'reportlab.graphics',
    'reportlab.lib',
    'reportlab.pdfbase',
    'reportlab.pdfgen',
    'reportlab.platypus',
    'sqlalchemy.dialects.sqlite',
    #'sqlalchemy.databases.sqlite',
    'sqlite3'
    ]}} )

解决方案

Ok, so i'm not sure if this is a truly "valid" work around, but it works and is rather simple.

I downloaded the most recent Sqlite dll from Sqlite. I simply replaced the Py2Exe generated Sqlite dll with this updated file and the program worked perfectly.

I am also using InnoSetup to compile an MSI installer, so one can simply copy the "newer" dll into the pre-compiled directory for inclusion into the MSI installer.

This worked for me. hope it helps others

这篇关于Py2Exe,Sqlite - 不是有效的Win 32应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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