将python3二进制文件包含到pyinstaller dist文件夹中

时间:2019-08-26 19:36:33

标签: python-3.x pyinstaller

我有互相交谈的java和python项目。我想把它们捆在一起。

我需要从捆绑的应用程序内的.java项目中调用python3脚本的可能性。

Java项目是一个GUI,它通过调用如下脚本与python对话:python3 myscript.py some_arguments_come_here

我使用pyinstaller捆绑了python项目。我成功地将.jar包含在Java项目及其所有依赖项中。

我看到/ dist文件夹包含“ Python”二进制文件,它是python 2.7。我设法从捆绑的Java程序访问此文件。问题是我需要python3而不是python2.7

是否可以在pyinstaller / dist文件夹中包含python3?

我使用pip3.7 install pyinstaller安装了pyinstaller。 Python代码仅适用于python3。

我正在使用OSX莫哈韦沙漠

47 INFO: Python: 3.7.1
52 INFO: Platform: Darwin-18.6.0-x86_64-i386-64bit
...

我尝试使用--add-data选项包括整个虚拟环境。 当尝试从这样的环境中调用python3时,我得到:

load error Fatal Python error: initfsencoding: unable to load the file system codec
load error ModuleNotFoundError: No module named 'encodings'
load error 
load error Current thread 0x000000011529b5c0 (most recent call first):
command finished Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

Current thread 0x000000011529b5c0 (most recent call first):

0 个答案:

没有答案