使用TABLA模块时发生错误,该错误正在获取子进程。调用的进程错误:命令'['java','Dfile.encoding=UTF8',…]

2024-10-06 11:23:31 发布

您现在位置:Python中文网/ 问答频道 /正文

在python中使用tabla模块时出错

subprocess.CalledProcessError:命令'['java','-Dfile.encoding=UTF8'

它在jupyter笔记本中正常运行,但上述错误仅在我尝试使用windows10 CMD中的pyinstaller包在可执行文件上运行时发生

代码是:

import tabula

def x_summary(file):
    file = 'path' +file +".pdf"
    tables = tabula.read_pdf(file,pages=1,multiple_tables=True)
    df_0=tables[0]
    return df
print(x_summary(c))

错误:

subprocess.CalledProcessError: Command '['java', '-Dfile.encoding=UTF8', '-jar', 'C:\\Users\\-----\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\tabula\\tabula-1.0.3-jar-with-dependencies.jar', '--pages', '1', '--stream', '--guess', '--format', 'JSON', 'C:\\Users\\----\\Desktop\\PDF_extraction\\----\\-----format\\PDF_Split_JPEGs\\-------.pdf']' returned non-zero exit status 1.

出于隐私考虑,我将一些文件名替换为“----”


Tags: dftablespdf错误pagesjavautf8summary