cx_freeze用sympy返回无效语法

时间:2022-07-25 18:23:14

I am trying to convert python code to a windows .exe using cx_freeze. When I run the setup.py using the command line it runs as usual and then just returns invalid syntax. The program uses the tkinter module as well as sympy and I believe it is the latter causing the problem. Any solutions will be much appreciated. Below is the last part of the process before it stops.

我试图使用cx_freeze将python代码转换为windows .exe。当我使用命令行运行setup.py时,它像往常一样运行,然后只返回无效的语法。该程序使用tkinter模块以及sympy,我相信后者会导致问题。任何解决方案将不胜感激。以下是该流程停止前的最后一部分。

deferredImports, namespace = namespace)

  File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 338, in _Intern
alImportModule
    parentModule, namespace)
  File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 366, in _LoadMo
dule
    module.code = compile(codeString, path, "exec")
  File "C:\Python33\lib\site-packages\sympy\mpmath\libmp\exec_py2.py", line 2
    exec string in globals, locals
              ^
SyntaxError: invalid syntax

1 个解决方案

#1


4  

The compatibility for exec in SymPy (actually mpmath, which is included with SymPy) uses a file that is only run in Python 2 that is invalid syntax in Python 3 and a file that is only run in Python 3 that is invalid syntax in Python 2. You can safely ignore the one on the other. If cx_freeze refuses to skip this file, you can safely delete it.

SymPy中exec的兼容性(实际上是mpmath,包含在SymPy中)使用的文件只在Python 2中运行,这是Python 3中无效的语法,而文件只在Python 3中运行,这是Python 2中无效的语法你可以安全地忽略另一个。如果cx_freeze拒绝跳过此文件,您可以安全地删除它。

#1


4  

The compatibility for exec in SymPy (actually mpmath, which is included with SymPy) uses a file that is only run in Python 2 that is invalid syntax in Python 3 and a file that is only run in Python 3 that is invalid syntax in Python 2. You can safely ignore the one on the other. If cx_freeze refuses to skip this file, you can safely delete it.

SymPy中exec的兼容性(实际上是mpmath,包含在SymPy中)使用的文件只在Python 2中运行,这是Python 3中无效的语法,而文件只在Python 3中运行,这是Python 2中无效的语法你可以安全地忽略另一个。如果cx_freeze拒绝跳过此文件,您可以安全地删除它。