0

我正在尝试将 Python 3.2.2 程序转换为使用cxfreeze. getstats.py我编写的 " " 程序在编译器和命令行中运行得很好。当我cxfreeze src\getstats.py在 Windows 命令行上运行来编译它时,我得到了一长串异常,最终导致SyntaxError: invalid syntax异常:

Traceback (most recent call last):
  File "C:\Python32\Scripts\cxfreeze", line 5, in <module>
    main()
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\main.py", line 188, in main
    freezer.Freeze()
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\freezer.py", line 470, in Freeze
    self._FreezeExecutable(executable)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\freezer.py", line 144, in _FreezeExecutable
    scriptModule = finder.IncludeFile(exe.script, exe.moduleName)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 492, in IncludeFile
    deferredImports)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 352, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 440, in _ScanCode
    module, relativeImportIndex)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 218, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 305, in _InternalImportModule
    parentModule, namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 317, in _LoadModule
    namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 362, in _LoadPackage
    self._LoadModule(name, fp, path, info, deferredImports, parent)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 352, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 440, in _ScanCode
    module, relativeImportIndex)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 254, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 305, in _InternalImportModule
    parentModule, namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 352, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 440, in _ScanCode
    module, relativeImportIndex)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 254, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 305, in _InternalImportModule
    parentModule, namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 352, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 440, in _ScanCode
    module, relativeImportIndex)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 218, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 289, in _InternalImportModule
    namespace = namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 305, in _InternalImportModule
    parentModule, namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 317, in _LoadModule
    namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 362, in _LoadPackage
    self._LoadModule(name, fp, path, info, deferredImports, parent)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 352, in _LoadModule
    self._ScanCode(module.code, module, deferredImports)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 440, in _ScanCode
    module, relativeImportIndex)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 254, in _ImportModule
    deferredImports, namespace = namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 305, in _InternalImportModule
    parentModule, namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 317, in _LoadModule
    namespace)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 362, in _LoadPackage
    self._LoadModule(name, fp, path, info, deferredImports, parent)
  File "C:\MyPython\Python\Python32\site-packages\cx_Freeze\finder.py", line 330, in _LoadModule
    module.code = compile(codeString, path, "exec")
  File "C:\MyPython\Python\Python32\site-packages\oauthlib\oauth1\rfc5849\__init__.py", line 18
    SIGNATURE_HMAC = u"HMAC-SHA1"

SyntaxError: invalid syntax

这是我第一次尝试使用cxfreeze,所以我不确定这里可能会损坏什么。该程序中使用的唯一“非标准”模块是requests. 想法?

4

0 回答 0