使用PyCharm社区IDE在Linux Mint上运行Python 3.6,尝试使用Nuitka编译一个小程序。我不确定是否有更简单的方法来添加子目录,但这是我用作编译脚本的方法,并且似乎可以找到所有导入内容:
python3.6 -m nuitka --recurse-all \
--include-plugin-directory=./venv/lib/python3.6/site-packages/serial \
--include-plugin-directory=./venv/lib/python3.6/site-packages/matplotlib \
--include-plugin-directory=./venv/lib/python3.6/site-packages/numpy \
--include-plugin-directory=./venv/lib/python3.6/site-packages/PIL \
--include-plugin-directory=./venv/lib/python3.6/site-packages/dateutil \
--plugin-enable=pylint-warnings \
gui.py
在到达PIL之前似乎还可以,并且出现错误:
AssertionError: globals_PIL
nuitka用户手册似乎对此错误保持沉默(如果我写错了,请纠正我)。如果还有其他选择可以将具有透明度的图像插入Tkinter GUI中,我将开放PIL。
这是完整的错误输出:
Nuitka:INFO:Interrupted while working on '<Node 'COMPILED_PYTHON_MODULE' with {'filename': '/home/******/PycharmProjects/*********/venv/lib/python3.6/site-packages/PIL/features.py', 'package': 'PIL', 'name': 'features'}>'.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/nuitka/__main__.py", line 184, in <module>
main()
File "/usr/lib/python3/dist-packages/nuitka/__main__.py", line 177, in main
MainControl.main()
File "/usr/lib/python3/dist-packages/nuitka/MainControl.py", line 759, in main
main_module = createNodeTree(filename=filename)
File "/usr/lib/python3/dist-packages/nuitka/MainControl.py", line 141, in createNodeTree
Optimization.optimize(main_module.getOutputFilename())
File "/usr/lib/python3/dist-packages/nuitka/optimizations/Optimization.py", line 542, in optimize
makeOptimizationPass(initial_pass=True)
File "/usr/lib/python3/dist-packages/nuitka/optimizations/Optimization.py", line 456, in makeOptimizationPass
changed = optimizeModule(current_module)
File "/usr/lib/python3/dist-packages/nuitka/optimizations/Optimization.py", line 167, in optimizeModule
changed = optimizeCompiledPythonModule(module)
File "/usr/lib/python3/dist-packages/nuitka/optimizations/Optimization.py", line 100, in optimizeCompiledPythonModule
module.computeModule()
File "/usr/lib/python3/dist-packages/nuitka/nodes/ModuleNodes.py", line 514, in computeModule
trace_collection=self.trace_collection
File "/usr/lib/python3/dist-packages/nuitka/nodes/StatementNodes.py", line 165, in computeStatementsSequence
new_statement = statement.computeStatementsSequence(trace_collection)
File "/usr/lib/python3/dist-packages/nuitka/nodes/FrameNodes.py", line 182, in computeStatementsSequence
new_statement = trace_collection.onStatement(statement=statement)
File "/usr/lib/python3/dist-packages/nuitka/optimizations/TraceCollections.py", line 549, in onStatement
new_statement, change_tags, change_desc = statement.computeStatement(self)
File "/usr/lib/python3/dist-packages/nuitka/nodes/AssignNodes.py", line 261, in computeStatement
trace_collection.onExpression(self.getAssignSource())
File "/usr/lib/python3/dist-packages/nuitka/optimizations/TraceCollections.py", line 530, in onExpression
r = expression.computeExpressionRaw(trace_collection=self)
File "/usr/lib/python3/dist-packages/nuitka/nodes/ExpressionBases.py", line 1005, in computeExpressionRaw
return self.computeExpression(trace_collection=trace_collection)
File "/usr/lib/python3/dist-packages/nuitka/nodes/ImportNodes.py", line 401, in computeExpression
trace_collection=trace_collection, module_name=imported_module_name
File "/usr/lib/python3/dist-packages/nuitka/nodes/ImportNodes.py", line 280, in _attemptRecursion
module_package=module_package,
File "/usr/lib/python3/dist-packages/nuitka/nodes/ImportNodes.py", line 210, in _consider
reason=reason,
File "/usr/lib/python3/dist-packages/nuitka/importing/Recursion.py", line 166, in recurseTo
reason=reason,
File "/usr/lib/python3/dist-packages/nuitka/importing/Recursion.py", line 82, in _recurseTo
is_shlib=module_kind == "shlib",
File "/usr/lib/python3/dist-packages/nuitka/tree/Building.py", line 941, in decideModuleTree
source_ref=source_ref,
File "/usr/lib/python3/dist-packages/nuitka/nodes/ModuleNodes.py", line 598, in __init__
source_ref=source_ref,
File "/usr/lib/python3/dist-packages/nuitka/nodes/ModuleNodes.py", line 274, in __init__
setLocalsDictType(self.module_dict_name, "module_dict")
File "/usr/lib/python3/dist-packages/nuitka/nodes/LocalsScopes.py", line 31, in setLocalsDictType
assert locals_dict_name not in locals_dict_handles, locals_dict_name
AssertionError: globals_PIL