【问题标题】:py2app Modules not found during compile on OSX 10在 OSX 10 上编译期间找不到 py2app 模块
【发布时间】:2015-03-02 16:43:17
【问题描述】:

在 (OS X 10.10) 上使用 py2app 将 python 脚本编译到 Mac 应用程序时出错 编译运行到最后,但给出错误消息。

设置脚本:

from setuptools import setup

APP = ['Main.py']
OPTIONS = {'iconfile':'LOGO.icns',}

setup(
    app = APP,
    options = {'py2app': OPTIONS},
    setup_requires = ['py2app'],
)

在主脚本上我只导入 3 个模块:

import os
from tkFileDialog import askdirectory
from Tkinter import Tk

我在终端中运行设置脚本,它创建了 2 个文件夹(build 和 Dist),里面装满了文件,但 Dist 中的应用程序文件没有做任何事情,甚至没有错误消息。

当我编译时,我在最后,在“完成”之前得到了这个错误:

未找到模块(无条件导入):
* ma​​in.需要 (pdb)
* _weakref.CallableProxyType (_weakrefset)
*_weakref.ProxyType (_weakrefset)
* _weakref.ReferenceType (_weakrefset)
* _weakref.getweakrefcount (_weakrefset)
*_weakref.getweakrefs (_weakrefset)
* _weakref.proxy (_weakrefset)
* errno.EINVAL (操作系统)
* errno.ENOENT (操作系统)
* java.System (java.lang)
* nt._getfullpathname (os)
* nt._isdir (os)
* org(复制,org.python.core)
* org.PyStringMap (org.python)
* org.python(复制,泡菜)
* org.python.core (pickle)
* org.python.core.PyStringMap(复制)
* pwd.getpwnam (getpass)
* sys.py3kwarning (操作系统)
* thread._local(集合)
* thread.allocate_lock(集合)
* thread.stack_size(集合)
* urllib.parse (pkg_resources)

未找到模块(条件导入):
* _md5 (hashlib)
* _sha (hashlib)
* importlib._bootstrap (pkg_resources)
* java(平台) * java.lang(平台)
* riscospath (os)

如果我直接从终端运行主脚本,则主脚本可以工作。

有什么想法吗??

【问题讨论】:

    标签: python macos py2app


    【解决方案1】:

    好像是路径太长造成的。

    My application is in a path 61 chars long:
    $ pwd|wc -c
          61
    

    我得到这个错误:

    未找到模块(条件导入):* importlib._bootstrap (pkg_resources)

    如果我删除路径中的几个字符,构建工作:

    $ pwd|wc -c
          59
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-19
      • 1970-01-01
      • 1970-01-01
      • 2015-01-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多