我一直试图用py2exe为使用jsonschema包的Python程序构建一个Windows可执行文件,但每次尝试运行该可执行文件时都会失败,并出现以下错误:
File "jsonschema\__init__.pyc", line 18, in <module>
File "jsonschema\validators.pyc", line 163, in <module>
File "jsonschema\_utils.pyc", line 57, in load_schema
File "pkgutil.pyc", line 591, in get_data
IOError: [Errno 0] Error: 'jsonschema\\schemas\\draft3.json'
我尝试在py2exe的包选项中添加json和jsonschema设置.py我还尝试手动将jsonschema目录从Python27\Libs\site包中的位置复制到图书馆.zip但这两种方法都不管用。我还尝试使用这里找到的解决方案(http://crazedmonkey.com/blog/python/pkg_resources-with-py2exe.html),它建议扩展py2exe以便能够将文件复制到zip文件中,但这似乎也不起作用。在
我假设发生这种情况是因为py2exe只在图书馆.zip,但我想知道是否有任何方法可以在不需要将draft3.json和draft4.json转换为原始位置的.py文件的情况下工作。在
提前谢谢你
好吧,经过更多的谷歌搜索(我讨厌难看的),我在没有修补构建的情况下让它正常工作_exe.py文件文件。整件事的关键是http://crazedmonkey.com/blog/python/pkg_resources-with-py2exe.html的配方。我的收集器类如下所示:
剩下的就是将其添加到核心设置中,如下所示:
^{pr2}$有些代码被省略了,因为它与上下文无关,但我想你明白了。在
相关问题 更多 >
编程相关推荐