Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/326.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将脚本转换为exe时无法执行脚本_Java_Python 3.x_Pyinstaller_Executable_Tabula Py - Fatal编程技术网

Java 将脚本转换为exe时无法执行脚本

Java 将脚本转换为exe时无法执行脚本,java,python-3.x,pyinstaller,executable,tabula-py,Java,Python 3.x,Pyinstaller,Executable,Tabula Py,我创建了一个脚本,使用tabla py和PyPDF2从pdf中提取数据。当我通过Jupyter笔记本和cmd运行我的程序时,它工作得非常好。使用pyinstaller将其转换为可执行文件后,出现以下错误: Error: Unable to access jarfile E:\Users\paulhong\AppData\Local\Temp\_MEI175522\tabula\tabula-1.0.2-jar-with-dependencies.jar Error: Traceback (mo

我创建了一个脚本,使用tabla py和PyPDF2从pdf中提取数据。当我通过Jupyter笔记本和cmd运行我的程序时,它工作得非常好。使用pyinstaller将其转换为可执行文件后,出现以下错误:

Error: Unable to access jarfile 
E:\Users\paulhong\AppData\Local\Temp\_MEI175522\tabula\tabula-1.0.2-jar-with-dependencies.jar
Error:
Traceback (most recent call last):
File "test.py", line 115, in <module>

File "test.py", line 32, in extractDataDik
tempDf = tabula.read_pdf(file, area = (72, 252, 115.2, 352.8), guess=False, pages='1')
File "site-packages\tabula\wrapper.py", line 108, in read_pdf
File "subprocess.py", line 395, in check_output
File "subprocess.py", line 487, in run
subprocess.CalledProcessError: Command '['java', '-Dfile.encoding=UTF8', '-jar', 
'E:\\Users\\paulhong\\AppData\\Local\\Temp\\_MEI175522\\tabula\\tabula-1.0.2-jar-with-dependencies.jar', '--pages', '1', '--area', 
'72,252,115.2,352.8', 'E:\\Users\\paulhong\\Desktop\\Purchase Order 
2\\SKM_C45819060508450 (003).pdf']' returned non-zero exit status 1. [47140] Failed to execute script test
错误:无法访问JAR文件
E:\Users\paulhong\AppData\Local\Temp\\u MEI175522\tabla\tabla-1.0.2-jar-with-dependencies.jar
错误:
回溯(最近一次呼叫最后一次):
文件“test.py”,第115行,在
extractDataDik中第32行的文件“test.py”
tempDf=tabla.read_pdf(文件,区域=(72252115.2352.8),guess=False,pages='1')
文件“site packages\tabla\wrapper.py”,第108行,只读pdf格式
检查输出中第395行的文件“subprocess.py”
文件“subprocess.py”,第487行,正在运行
subprocess.CalledProcessError:命令'['java','-Dfile.encoding=UTF8','-jar',
'E:\\Users\\paulhong\\AppData\\Local\\Temp\\\\u MEI175522\\tabla\\tabla-1.0.2-jar-with-dependencies.jar','--pages',1','--area',
'72252115.2352.8','E:\\Users\\paulhong\\Desktop\\Purchase Order
2\\SKM_C45819060508450(003).pdf']'返回非零退出状态1。[47140]无法执行脚本测试
我在指定路径上也找不到文件夹_MEI175522

我的python版本是3.7.1 Java版本是1.8 pyinstaller的版本是3.4 tabla-py是最新版本


如何解决此问题?

看起来tabla模块没有被复制到可执行文件的dist文件夹中,根据我的经验,这是pyinstaller的一个常见问题,它经常会丢失python目录中的包

转到dist文件夹,检查tabla文件夹是否存在,如果不存在,则需要将其复制过来

转到python目录,它应该位于如下位置:
C:\Users\\AppData\Local\Programs\Python\Python37-32\Lib\site软件包


从这里复制任何需要放在dist文件夹中的包

我遇到了类似的问题,我可以使用此链接上的解决方案解决它:


我在一个虚拟环境中构建了我的应用程序,因此我在我的
网站包
文件夹中添加了一个
tabla
文件夹,其中包含
tabla-1.0.2-jar-with-dependencies.jar
文件。运行命令
pyinstaller--add data apps\Lib\site packages\tabla\tabla-1.0.2-jar-with-dependencies.jar;tabla--onefile Table_OCR.py
为我正确地构建了可执行文件。

很抱歉回复太晚,我使用“-onefile”选项创建了一个独立的可执行文件。我认为在这种情况下,您不需要在dist文件夹中有一个tabla文件夹,我如何修复独立可执行文件?我需要指定挂钩吗?