gpt4 book ai didi

python - 在 OSX 10 上编译期间未找到 py2app 模块

转载 作者:太空宇宙 更新时间:2023-11-03 17:53:26 26 4
gpt4 key购买 nike

在 (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 内的应用程序文件不执行任何操作,甚至没有错误消息。

当我编译时,我在“完成”之前的最后收到此错误:

Modules not found (unconditional imports):
* main.requires (pdb)
* _weakref.CallableProxyType (_weakrefset)
*_weakref.ProxyType (_weakrefset)
* _weakref.ReferenceType (_weakrefset)
* _weakref.getweakrefcount (_weakrefset)
*_weakref.getweakrefs (_weakrefset)
* _weakref.proxy (_weakrefset)
* errno.EINVAL (os)
* errno.ENOENT (os)
* java.System (java.lang)
* nt._getfullpathname (os)
* nt._isdir (os)
* org (copy, org.python.core)
* org.PyStringMap (org.python)
* org.python (copy, pickle)
* org.python.core (pickle)
* org.python.core.PyStringMap (copy)
* pwd.getpwnam (getpass)
* sys.py3kwarning (os)
* thread._local (collections)
* thread.allocate_lock (collections)
* thread.stack_size (collections)
* urllib.parse (pkg_resources)

Modules not found (conditional imports):
* _md5 (hashlib)
* _sha (hashlib)
* importlib._bootstrap (pkg_resources)
* java (platform) * java.lang (platform)
* riscospath (os)

如果我直接从终端运行主脚本,主脚本就会工作。

有什么想法吗?

最佳答案

这似乎是由于路径太长造成的。

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

我收到此错误:

Modules not found (conditional imports): * importlib._bootstrap (pkg_resources)

如果我删除路径中的一些字符,构建就会起作用:

$ pwd|wc -c
59

关于python - 在 OSX 10 上编译期间未找到 py2app 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28815031/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com