2017-08-17 289 views
0

我刚刚开始了解python语言,并且我只知道基础知识。 我试图在使用nuitka的ubuntu中编译一个小命令时发现问题。如何克服python的编译(Nuitka)错误

注:我在这里使用的python版本是python 3.6 这是我的$ sample.py $。

Print ("Hello user.") 

这里是命令行我用来编译代码...

nuitka --recurse-on --python-version=3.6 sample.py 

当我使用这个命令,我得到这个作为输出...

sample.build/CompiledAsyncgenType.c: In function 
‘Nuitka_Asyncgen_unwrap_value’: 
sample.build/CompiledAsyncgenType.c:994:9: warning: implicit declaration    
of function ‘_PyGen_SetStopIterationValue’ [-Wimplicit-function-declaration] 
    _PyGen_SetStopIterationValue(((_PyAsyncGenWrappedValue*)result)->agw_val);    

    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
sample.build/CompiledAsyncgenType.o: In function  
`Nuitka_Asyncgen_unwrap_value.isra.9': 
CompiledAsyncgenType.c:(.text+0x118c): undefined reference to  
`_PyGen_SetStopIterationValue' 
sample.build/CompiledAsyncgenType.o: In function 
`Nuitka_AsyncgenAsend_throw': 
CompiledAsyncgenType.c:(.text+0x2337): undefined reference to  
`_PyGen_SetStopIterationValue' 
sample.build/CompiledAsyncgenType.o: In function 
`Nuitka_AsyncgenAthrow_throw': 
CompiledAsyncgenType.c:(.text+0x295f): undefined reference to  
`_PyGen_SetStopIterationValue' 
sample.build/CompiledAsyncgenType.o: In function 
`Nuitka_AsyncgenAthrow_iternext': 
CompiledAsyncgenType.c:(.text+0x30e8): undefined reference to  
`_PyGen_SetStopIterationValue' 
sample.build/CompiledAsyncgenType.o: In function 
`Nuitka_AsyncgenAsend_tp_iternext': 
CompiledAsyncgenType.c:(.text+0x37b7): undefined reference to  
`_PyGen_SetStopIterationValue' 
sample.build/CompiledAsyncgenType.o:CompiledAsyncgenType.c:(.text+0x3fe7):  
more undefined references to `_PyGen_SetStopIterationValue' follow 
collect2: error: ld returned 1 exit status 
scons: *** [sample.exe] Error 1 

请帮我解决这个问题的家伙!! ...

回答

0

有两个问题,也会导致CPython失败(参考实施心理状态)。

  1. 用大写字母P打印的内容并没有内置到Python中。内置的 函数以小写字母p开头。
  2. 单行程序不应缩进。
+0

将尝试你所说的话后更新,先生... –