使用 py2app 创建应用程序时出现问题:缺少 rubicon

问题描述 投票:0回答:1

我正在尝试在 Mac 上从我的 python 脚本创建一个应用程序。每次我尝试通过在终端中运行 $ python setup.py py2app 来创建它时,我都会收到错误“ ImportError:没有名为 'rubicon' 的模块”。我知道 rubicon 已安装。

我已经尝试寻找解决方案有一段时间了。如果有帮助,这是我的安装文件(我确保导入的所有模块都已通过 pip 安装)。

`setup.py:

import os
from setuptools import setup

APP = ['main.py']

OPTIONS = {
    'argv_emulation': True,
    'iconfile': 'icons8-automation-64.png'
}

# Get the path to the data_folder relative to the setup.py script
data_folder_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data_folder')

# List of data files to include in the app bundle
DATA_FILES = [
    ('data_folder', [os.path.join(data_folder_path, filename) for filename in os.listdir(data_folder_path)])
]

setup(
    name='AchToCRM',
    app=APP,
    data_files=DATA_FILES,  # Include the data_folder in the app bundle
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
    install_requires=[
        'selenium',
        'pandas',
        'openpyxl',
        'pyautogui'
    ]
)`

这是我第一篇在 Stack Overflow 上发表的帖子,所以感谢您对我的包容。

我已经卸载并重新安装了rubicon多次,我也确认了rubicon存在于venv文件夹中。 当我在终端中运行 pip show rubicon-objc 时,它显示 名称: rubicon-objc 版本:0.4.6

python macos type-conversion setup.py py2app
1个回答
0
投票

如果您的应用程序不使用此模块或其中使用的模块不依赖于 rubicon,请尝试将选项 'excludes': ['rubicon'] 添加到 setup.py 文件中的选项中。 指定 py2app 忽略应用程序的 rubicon 模块组件。

OPTIONS = {
    'argv_emulation': True,
    'iconfile': 'icons8-automation-64.png'
},
    'excludes': ['rubicon'],
© www.soinside.com 2019 - 2024. All rights reserved.