Py2App找不到标准模块 [英] Py2App Can't find standard modules

查看:138
本文介绍了Py2App找不到标准模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用py2app创建了一个应用程序,该应用程序运行良好,但是如果我将其压缩/解压缩,则新解压缩的版本将无法访问标准的python模块,例如traceback或os. zip的手册页声称它保留了资源派生,并且我已经看到了其他以这种方式打包的应用程序(我需要能够将其放入.zip文件中).我该如何解决?

I've created an app using py2app, which works fine, but if I zip/unzip it, the newly unzipped version can't access standard python modules like traceback, or os. The manpage for zip claims that it preserves resource forks, and I've seen other applications packaged this way (I need to be able to put this in a .zip file). How do I fix this?

推荐答案

这是由于构建了一个半独立版本而导致的,该版本包含指向本地安装文件的符号链接,正如您所说,这些链接是除非使用" -y "选项,否则在压缩/解压缩时会丢失.

This is caused by building a semi-standalone version that contains symlinks to the natively installed files and as you say, the links are lost when zipping/unzipping unless the "-y" option is used.

另一种解决方案是改为为独立构建,该解决方案将(公共领域)文件放入应用程序中,因此可以更好地进行zip/unzip压缩.这也意味着该应用程序对基础操作系统的更改更具弹性.缺点是,它当然更大,并且设置起来更复杂.

An alternate solution is to build for standalone instead, which puts (public domain) files inside the application and so survives zipping/unzipping etc. better. It also means the app is more resilient to changes in the underlying OS. The downside is that it is bigger, of course, and is more complicated to get it set up.

要构建独立版本,您需要安装可重新打包的python.org版本. 此处对此方法进行了解释,但请阅读注释,因为自博客发布以来已有一些更改.是写的.

To build a stand alone version, you need to install the python.org version which can be repackaged. An explanation of how to do this is here, but read the comments as there have been some changes since the blog post was written.

这篇关于Py2App找不到标准模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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