Python 用py2exe制作胶状应用
我正在尝试使用py2exe将带有自定义GUI的Scrapy spider打包到windows可执行文件中。GUI从外部脚本调用spider。当直接从Python脚本运行时,这一切都可以正常工作。使用py2exe打包时遇到错误。这与问题非常相似,但使用py2exe而不是cx\u-freeze。我曾尝试使用cx_freeze跟踪该帖子和包,但仍然收到相同的错误。下面是我正在使用的py2exe setup.py:Python 用py2exe制作胶状应用,python,python-2.7,web-scraping,scrapy,py2exe,Python,Python 2.7,Web Scraping,Scrapy,Py2exe,我正在尝试使用py2exe将带有自定义GUI的Scrapy spider打包到windows可执行文件中。GUI从外部脚本调用spider。当直接从Python脚本运行时,这一切都可以正常工作。使用py2exe打包时遇到错误。这与问题非常相似,但使用py2exe而不是cx\u-freeze。我曾尝试使用cx_freeze跟踪该帖子和包,但仍然收到相同的错误。下面是我正在使用的py2exe setup.py: from distutils.core import setup import py2e
from distutils.core import setup
import py2exe
includes = ['scrapy', 'os', 'twisted']
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'Tkinter']
packages = []
dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
'tk84.dll']
setup(
options = {"py2exe": {"compressed": 2,
"optimize": 2,
"includes": ['lxml.etree', 'lxml._elementpath', 'gzip'],
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 3,
"dist_dir": "dist",
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},
windows=['ItemStatusChecker.py']
)
一切正常编译,但在运行exe文件时,出现以下错误:
Traceback (most recent call last):
File "ItemStatusChecker.py", line 92, in OnButtonClicked
crawler = Crawler(settings)
File "scrapy\crawler.pyo", line 20, in __init__
File "scrapy\utils\misc.pyo", line 42, in load_object
ImportError: Error loading object 'scrapy.statscol.MemoryStatsCollector': No module named statscol
我可以在my setup.py中为py2exe做些什么,以确保将完整的软件包拉入到我的应用程序中,并且我可以访问所有功能(类似于上面链接的帖子中的解决方案)