我在尝试将Pyinstaller与Pandas一起使用时遇到意外的EOF错误。我不知道是什么原因造成的

2024-04-19 07:12:20 发布

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

当我试图编译一个使用多个库的大型程序时,我遇到了一个EOF错误。经过一些测试,我发现Pandas和Pyinstaller之间存在问题

我将代码归结为:

import pandas as pd
data = pd.read_csv('matplotTEST.csv')
print(data)

我运行命令:

pyinstaller --onefile --clean testingPyinstaller.py

并得到以下EOF错误:

D:\Export\BinGen>pyinstaller --onefile --clean BinGenTopLevel.py
68 INFO: PyInstaller: 3.6
68 INFO: Python: 3.8.3
68 INFO: Platform: Windows-10-10.0.18362-SP0
69 INFO: wrote D:\Export\BinGen\BinGenTopLevel.spec
71 INFO: UPX is not available.
71 INFO: Removing temporary files and cleaning cache in C:\Users\matth\AppData\Roaming\pyinstaller
77 INFO: Extending PYTHONPATH with paths
['D:\\Export\\BinGen', 'D:\\Export\\BinGen']
77 INFO: checking Analysis
77 INFO: Building Analysis because Analysis-00.toc is non existent
77 INFO: Initializing module dependency graph...
80 INFO: Caching module graph hooks...
87 INFO: Analyzing base_library.zip ...
3135 INFO: Processing pre-find module path hook   distutils
3137 INFO: distutils: retargeting to non-venv dir 'c:\\users\\matth\\appdata\\local\\programs\\python\\python38-32\\lib'
6764 INFO: Caching module dependency graph...
6880 INFO: running Analysis Analysis-00.toc
6884 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\users\matth\appdata\local\programs\python\python38-32\python.exe
7000 INFO: Analyzing D:\Export\BinGen\BinGenTopLevel.py
8117 INFO: Processing pre-find module path hook   site
8118 INFO: site: retargeting to fake-dir 'c:\\users\\matth\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\PyInstaller\\fake-modules'
9477 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
14584 INFO: Processing pre-safe import module hook   six.moves
23058 INFO: Processing module hooks...
23058 INFO: Loading module hook "hook-distutils.py"...
23061 INFO: Loading module hook "hook-encodings.py"...
23145 INFO: Loading module hook "hook-lib2to3.py"...
23153 INFO: Loading module hook "hook-lxml.etree.py"...
23155 INFO: Loading module hook "hook-matplotlib.backends.py"...
23743 INFO:   Matplotlib backend "GTK3Agg": ignored
    backend Gtk3Agg requires cairo
24071 INFO:   Matplotlib backend "GTK3Cairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
24387 INFO:   Matplotlib backend "MacOSX": ignored
    cannot import name '_macosx' from 'matplotlib.backends' (c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\matplotlib\backends\__init__.py)
24703 INFO:   Matplotlib backend "nbAgg": ignored
    No module named 'IPython'
25053 INFO:   Matplotlib backend "Qt4Agg": ignored
    Failed to import any qt binding
25371 INFO:   Matplotlib backend "Qt4Cairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
25708 INFO:   Matplotlib backend "Qt5Agg": ignored
    Failed to import any qt binding
26030 INFO:   Matplotlib backend "Qt5Cairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
26480 INFO:   Matplotlib backend "TkAgg": added
26925 INFO:   Matplotlib backend "TkCairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
27244 INFO:   Matplotlib backend "WebAgg": ignored
    Traceback (most recent call last):
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\matplotlib\backends\backend_webagg.py", line 27, in <module>
    import tornado
ModuleNotFoundError: No module named 'tornado'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 12, in <module>
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\matplotlib\backends\backend_webagg.py", line 29, in <module>
    raise RuntimeError("The WebAgg backend requires Tornado.")
RuntimeError: The WebAgg backend requires Tornado.
27670 INFO:   Matplotlib backend "WX": ignored
    No module named 'wx'
27990 INFO:   Matplotlib backend "WXAgg": ignored
    No module named 'wx'
28306 INFO:   Matplotlib backend "WXCairo": ignored
    No module named 'wx'
28626 INFO:   Matplotlib backend "agg": added
28942 INFO:   Matplotlib backend "cairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
29399 INFO:   Matplotlib backend "pdf": added
29828 INFO:   Matplotlib backend "pgf": added
30160 INFO:   Matplotlib backend "ps": added
30483 INFO:   Matplotlib backend "svg": added
30909 INFO:   Matplotlib backend "template": added
31167 INFO: Loading module hook "hook-matplotlib.py"...
31463 INFO: Loading module hook "hook-numpy.core.py"...
31565 INFO: Loading module hook "hook-numpy.py"...
31566 INFO: Loading module hook "hook-pandas.py"...
32299 INFO: Loading module hook "hook-PIL.Image.py"...
32774 INFO: Loading module hook "hook-PIL.py"...
32776 INFO: Excluding import 'PyQt4'
32779 INFO: Excluding import 'tkinter'
32781 INFO:   Removing import of tkinter from module PIL.ImageTk
32781 INFO: Import to be excluded not found: 'PySide'
32782 INFO: Import to be excluded not found: 'FixTk'
32782 INFO: Excluding import 'PyQt5'
32784 INFO:   Removing import of PyQt5 from module PIL.ImageQt
32784 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
32786 INFO: Excluding import 'tkinter'
32787 INFO: Import to be excluded not found: 'FixTk'
32788 INFO: Loading module hook "hook-pkg_resources.py"...
33118 INFO: Processing pre-safe import module hook   win32com
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
33175 INFO: Processing pre-safe import module hook   win32com
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
33409 INFO: Excluding import '__main__'
33410 INFO:   Removing import of __main__ from module pkg_resources
33411 INFO: Loading module hook "hook-pydoc.py"...
33412 INFO: Loading module hook "hook-pytz.py"...
33474 INFO: Loading module hook "hook-setuptools.py"...
34016 INFO: Loading module hook "hook-sqlalchemy.py"...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\sqlalchemy\__init__.py", line 12, in <module>
    from sqlalchemy.sql import (
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\sqlalchemy\sql\__init__.py", line 7, in <module>
    from sqlalchemy.sql.expression import (
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\sqlalchemy\sql\expression.py", line 32, in <module>
    from sqlalchemy import util, exc
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\sqlalchemy\util\__init__.py", line 7, in <module>
    from .compat import callable, cmp, reduce, defaultdict, py25_dict, \
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\sqlalchemy\util\compat.py", line 202, in <module>
    time_func = time.clock
AttributeError: module 'time' has no attribute 'clock'
Traceback (most recent call last):
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\matth\AppData\Local\Programs\Python\Python38-32\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\build_main.py", line 734, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\build_main.py", line 681, in build
    exec(code, spec_namespace)
  File "D:\Export\BinGen\BinGenTopLevel.spec", line 6, in <module>
    a = Analysis(['BinGenTopLevel.py'],
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\build_main.py", line 244, in __init__
    self.__postinit__()
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
    self.assemble()
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\build_main.py", line 422, in assemble
    self.graph.process_post_graph_hooks()
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\depend\analysis.py", line 311, in process_post_graph_hooks
    module_hook.post_graph()
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\depend\imphook.py", line 417, in post_graph
    self._load_hook_module()
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\depend\imphook.py", line 383, in _load_hook_module
    self._hook_module = importlib_load_source(
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\compat.py", line 797, in importlib_load_source
    return mod_loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 462, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 962, in load_module
  File "<frozen importlib._bootstrap_external>", line 787, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 702, in _load
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "c:\users\matth\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\hooks\hook-sqlalchemy.py", line 30, in <module>
    dialects = eval(dialects.strip())
  File "<string>", line 0

    ^
SyntaxError: unexpected EOF while parsing

有人能帮我找出是什么引起的吗


Tags: inpyinfobackendliblocallinehook