相关疑难解决方法(0)

如何使用 Pyinstaller 捆绑 .jar 文件

您如何让pyinstaller将 .jar 文件捆绑为使用它们的 python 项目的存档?

例如,要制作一个 exe(我使用pyjnius来处理sikuli-standalone jar):

# test.py
import os
import sys

# set the classpath so java can find the code I want to work with
sikuli_jar = '/sikuli-api.standalone-1.0.3-Pre-1.jar'
jarpath = os.path.dirname(os.path.realpath(__file__)) + sikuli_jar
os.environ['CLASSPATH'] = jarpath

# now load a java class
from jnius import autoclass
API = autoclass('org.sikuli.api.API')
Run Code Online (Sandbox Code Playgroud)

Pyisntaller 使用以下命令创建(一个文件夹)exe:

pyinstaller -d test.py

但据我所知,jar 没有捆绑并且 exe 无法访问,除非您手动将它放在 Pyinstaller 生成的文件夹中

根据Pyinstaller 手册

“CArchive 包含您想要的任何内容。它非常像一个 …

python specifications jar pyinstaller pyjnius

5
推荐指数
1
解决办法
1227
查看次数

标签 统计

jar ×1

pyinstaller ×1

pyjnius ×1

python ×1

specifications ×1