我在使用pyinstaller时遇到问题

时间:2019-02-25 07:44:01

标签: python pyqt5 pyinstaller openpyxl

我使用pycharm创建了一个简单的python代码。 (Python 3.6.4,32位)

这是一个简单的程序,可从excel读取数据并在gui屏幕上显示数据。

当我使用pyinstaller制作exe文件时,出现错误 (RecursionError:超过最大递归深度)。

这是我的全部代码。

import sys
from PyQt5.QtWidgets import *
from PyQt5 import uic
import openpyxl

form_class = uic.loadUiType("module1_20190216.ui")[0]

wb = openpyxl.load_workbook('a.xlsx', data_only=True)
ws = wb.active

ko_value = ws.cell(42,2).value
ko = "                " + str(ko_value)
pep_value = ws.cell(42,3).value
pep = "                " + str(pep_value)
cot_value = ws.cell(42,4).value
cot = "                " + str(cot_value)
fizz_value = ws.cell(42,5).value
fizz = "                " + str(fizz_value)

ko_at = ws.cell(44,2).value
koat = "                " + str(ko_at)
pep_at = ws.cell(44,3).value
pepat = "                " + str(pep_at)
cot_at = ws.cell(44,4).value
cotat = "                " + str(cot_at)
fizz_at = ws.cell(44,5).value
fizzat = "                " + str(fizz_at)

k = 0.2282
value_ko = 50 + ((13.695-ko_at)/(2*k))
value_pep = 50 + ((13.695-pep_at)/(2*k))
value_cot = 50 + ((13.695-cot_at)/(2*k))
value_fizz = 50 + ((13.695-fizz_at)/(2*k))

class MyWindow(QMainWindow, form_class):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        self.pushButton.clicked.connect(self.btn_clicked)

    def btn_clicked(self):
        self.ko_bvps.setText(ko[0:22])
        self.pep_bvps.setText(pep[0:22])
        self.cot_bvps.setText(cot[0:22])
        self.fizz_bvps.setText(fizz[0:22])

        self.ko_attract.setText(koat[0:22])
        self.pep_attract.setText(pepat[0:22])
        self.cot_attract.setText(cotat[0:22])
        self.fizz_attract.setText(fizzat[0:22])

        self.ko_progressBar.setValue(value_ko)
        self.pep_progressBar.setValue(value_pep)
        self.cot_progressBar.setValue(value_cot)
        self.fizz_progressBar.setValue(value_fizz)

if __name__ == "__main__":
    app = QApplication(sys.argv)
    myWindow = MyWindow()
    myWindow.show()
    app.exec_()
    wb.close()

这是我的错误

C:\Users\leeseungyeup\PycharmProjects\20190216>pyinstaller --noconsole --onefile sample.py
54 INFO: PyInstaller: 3.5.dev0+42ab9dbb4
54 INFO: Python: 3.6.4
57 INFO: Platform: Windows-10-10.0.17763-SP0
63 INFO: wrote C:\Users\leeseungyeup\PycharmProjects\20190216\sample.spec
66 INFO: UPX is not available.
68 INFO: Extending PYTHONPATH with paths
['C:\\Users\\leeseungyeup\\PycharmProjects\\20190216',
 'C:\\Users\\leeseungyeup\\PycharmProjects\\20190216']
70 INFO: checking Analysis
71 INFO: Building Analysis because Analysis-00.toc is non existent
71 INFO: Initializing module dependency graph...
75 INFO: Initializing module graph hooks...
81 INFO: Analyzing base_library.zip ...
4628 INFO: running Analysis Analysis-00.toc
4649 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\anaconda3\python.exe
5298 INFO: Caching module hooks...
5303 INFO: Analyzing C:\Users\leeseungyeup\PycharmProjects\20190216\sample.py
5593 INFO: Processing pre-find module path hook   PyQt5.uic.port_v3
5685 INFO: Processing pre-find module path hook   PyQt5.uic.port_v2
8285 INFO: Processing pre-find module path hook   distutils
9460 INFO: Processing pre-find module path hook   site
9464 INFO: site: retargeting to fake-dir 'c:\\anaconda3\\lib\\site-packages\\PyInstaller\\fake-modules'
10702 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
16851 INFO: Processing pre-safe import module hook   six.moves
25846 INFO: Processing pre-safe import module hook   urllib3.packages.six.moves
44003 INFO: Processing pre-safe import module hook   win32com
Traceback (most recent call last):
  File "c:\anaconda3\lib\site-packages\pkg_resources\_vendor\packaging\version.py", line 31, in parse
    return Version(version)
  File "c:\anaconda3\lib\site-packages\pkg_resources\_vendor\packaging\version.py", line 202, in __init__
    raise InvalidVersion("Invalid version: '{0}'".format(version))
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: 'alabaster'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Anaconda3\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
  File "c:\anaconda3\lib\site-packages\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\anaconda3\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 844, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 791, in build
    exec(code, spec_namespace)
  File "C:\Users\leeseungyeup\PycharmProjects\20190216\sample.spec", line 17, in <module>
    noarchive=False)
  File "c:\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 243, in __init__
    self.__postinit__()
  File "c:\anaconda3\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
    self.assemble()
  File "c:\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 445, in assemble
    priority_scripts.append(self.graph.run_script(script))
  File "c:\anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 201, in run_script
    self._top_script_node = super(PyiModuleGraph, self).run_script(pathname)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1401, in run_script
    self._scan_code(m, co, co_ast)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2636, in _scan_code
    self._process_imports(module)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2835, in _process_imports
    target_module = self._safe_import_hook(*import_info, **kwargs)[0]
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2291, in _safe_import_hook
    target_attr_names=None, level=level, edge_attr=edge_attr)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1474, in import_hook
    source_package, target_module_partname, level)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1631, in _find_head_package
    target_module_headname, target_package_name, source_package)
  File "c:\anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 271, in _safe_import_module
    module_basename, module_name, parent_package)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2048, in _safe_import_module
    module_name, file_handle, pathname, metadata)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2086, in _load_module
    m = self._load_package(fqname, pathname, packagepath)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2905, in _load_package
    self._load_module(fqname, fp, buf, stuff)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2152, in _load_module
    self._scan_code(m, co, co_ast)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2636, in _scan_code
    self._process_imports(module)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2835, in _process_imports
    target_module = self._safe_import_hook(*import_info, **kwargs)[0]
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2291, in _safe_import_hook
    target_attr_names=None, level=level, edge_attr=edge_attr)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1475, in import_hook
    target_module = self._load_tail(target_package, target_module_partname)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1694, in _load_tail
    submodule = self._safe_import_module(head, mname, submodule)
  File "c:\anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 271, in _safe_import_module
    module_basename, module_name, parent_package)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2048, in _safe_import_module
    module_name, file_handle, pathname, metadata)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2086, in _load_module
    m = self._load_package(fqname, pathname, packagepath)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2905, in _load_package
    self._load_module(fqname, fp, buf, stuff)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2152, in _load_module
    self._scan_code(m, co, co_ast)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2636, in _scan_code
    self._process_imports(module)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2835, in _process_imports
    target_module = self._safe_import_hook(*import_info, **kwargs)[0]
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2291, in _safe_import_hook
    target_attr_names=None, level=level, edge_attr=edge_attr)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1474, in import_hook
    source_package, target_module_partname, level)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1631, in _find_head_package
    target_module_headname, target_package_name, source_package)
  File "c:\anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 271, in _safe_import_module
    module_basename, module_name, parent_package)
                                                                    ~~~
                                                                    ~~~

  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1785, in _import_importable_package_submodules
    attr_name, submodule_name, package)
  File "c:\anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 271, in _safe_import_module
    module_basename, module_name, parent_package)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2048, in _safe_import_module
    module_name, file_handle, pathname, metadata)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2152, in _load_module
    self._scan_code(m, co, co_ast)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2636, in _scan_code
    self._process_imports(module)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2835, in _process_imports
    target_module = self._safe_import_hook(*import_info, **kwargs)[0]
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2291, in _safe_import_hook
    target_attr_names=None, level=level, edge_attr=edge_attr)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1475, in import_hook
    target_module = self._load_tail(target_package, target_module_partname)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1694, in _load_tail
    submodule = self._safe_import_module(head, mname, submodule)
  File "c:\anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 271, in _safe_import_module
    module_basename, module_name, parent_package)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2048, in _safe_import_module
    module_name, file_handle, pathname, metadata)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2152, in _load_module
    self._scan_code(m, co, co_ast)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2636, in _scan_code
    self._process_imports(module)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2835, in _process_imports
    target_module = self._safe_import_hook(*import_info, **kwargs)[0]
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2291, in _safe_import_hook
    target_attr_names=None, level=level, edge_attr=edge_attr)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1475, in import_hook
    target_module = self._load_tail(target_package, target_module_partname)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1694, in _load_tail
    submodule = self._safe_import_module(head, mname, submodule)
  File "c:\anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 271, in _safe_import_module
    module_basename, module_name, parent_package)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2048, in _safe_import_module
    module_name, file_handle, pathname, metadata)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2086, in _load_module
    m = self._load_package(fqname, pathname, packagepath)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2878, in _load_package
    ns_pkgpath = _namespace_package_path(fqname, pkgpath or [], self.path)
  File "c:\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 162, in _namespace_package_path
    working_set = pkg_resources.WorkingSet(path)
  File "c:\anaconda3\lib\site-packages\pkg_resources\__init__.py", line 650, in __init__
    self.add_entry(entry)
  File "c:\anaconda3\lib\site-packages\pkg_resources\__init__.py", line 706, in add_entry
    for dist in find_distributions(entry, True):
  File "c:\anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2044, in find_on_path
    path_item_entries = _by_version_descending(filtered)
  File "c:\anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2017, in _by_version_descending
    return sorted(names, key=_by_version, reverse=True)
  File "c:\anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2015, in _by_version
    return [packaging.version.parse(part) for part in parts]
  File "c:\anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2015, in <listcomp>
    return [packaging.version.parse(part) for part in parts]
  File "c:\anaconda3\lib\site-packages\pkg_resources\_vendor\packaging\version.py", line 33, in parse
    return LegacyVersion(version)
  File "c:\anaconda3\lib\site-packages\pkg_resources\_vendor\packaging\version.py", line 76, in __init__
    self._key = _legacy_cmpkey(self._version)
  File "c:\anaconda3\lib\site-packages\pkg_resources\_vendor\packaging\version.py", line 141, in _legacy_cmpkey
    for part in _parse_version_parts(version.lower()):
RecursionError: maximum recursion depth exceeded

我不知道如何解决这个问题。请,如果您有时间,请帮助我。...

0 个答案:

没有答案