为什么PyInstaller找不到合适的pybtex插件?

时间:2019-11-27 14:29:50

标签: python-3.x pyinstaller pysimplegui pybtex

我试图用Python(3.7.3)开发GUI,以便将BibTex引用添加到库中。为此,我使用PySimpleGUI(4.7)作为接口,使用Pybtex(0.22.2)处理引用,使用PyInstaller(3.5)生成可执行文件。

从Python IDLE执行脚本时,我没有遇到任何问题。但是,在执行Windows可执行文件时,出现以下错误:

Traceback (most recent call last):
  File "Pybtex_exe_problem.py", line 17, in <module>
    """, 'bibtex')
  File "site-packages\pybtex\database\__init__.py", line 872, in parse_string
  File "site-packages\pybtex\plugin\__init__.py", line 106, in find_plugin
  File "site-packages\pybtex\plugin\__init__.py", line 81, in _load_entry_point
pybtex.plugin.PluginNotFound: plugin pybtex.database.input.bibtex not found
[17304] Failed to execute script Pybtex_exe_problem

似乎可以从Python IDLE中找到插件bibtex.py,但不能在PyInstaller环境中找到。

有什么建议可以解决这个问题?

下面是产生上述错误的代码。

import PySimpleGUI as sg
from pybtex.database import parse_file, parse_string

#--------------------------------------------------------------------------------------------------
wrkBib = parse_string("""
@article{Muller2015,
  doi = {10.3389/fninf.2015.00011},
  url = {https://doi.org/10.3389/fninf.2015.00011},
  year = {2015},
  month = apr,
  publisher = {Frontiers Media {SA}},
  volume = {9},
  author = {Eilif Muller and James A. Bednar and Markus Diesmann and Marc-Oliver Gewaltig and Michael Hines and Andrew P. Davison},
  title = {Python in neuroscience},
  journal = {Frontiers in Neuroinformatics}
}
""", 'bibtex')

#--------------------------------------------------------------------------------------------------
layout = [
        [sg.T('Display a BibTex reference')],
        [sg.Output(size=(120,20))],
        [sg.Button('Display'), sg.Button('Close')]
     ]

window = sg.Window('BibTex Manager', default_element_size=(80,1),font='Any 10').Layout(layout)

#--------------------------------------------------------------------------------------------------
while True:
    event, values = window.read()

    if event in (None, 'Close'):   # if user closes window or clicks cancel
        break

    if event is 'Display':
        print(wrkBib.to_string('bibtex'))

window.close()

0 个答案:

没有答案