nuitka打包报错整理

3周前 (05-30)学习109

报错一

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb9 in position 4626: invalid start byte
Nuitka-Reports: Compilation crash report written to file 'nuitka-crash-report.xml'. Please include it in your bug report.

python代码里面有文件是GBK编码,需要改为UTF-8

查看打包进度,应该是下一个没显示进度的文件编码错误了。

 

报错二

FATAL: Error, data files for modules must be done via wheels, or commercial plugins '--embed-*' options. Not done for 'static\add.html'.

这个报错是打包的时候静态文件不能打包。我的是在目录下存放的html文件,打包的时候想放到包里面,但是报错了。

解决方法就是不打包一起,打包完后把静态文件和包放到同一目录运行。

 

报错三

django.core.exceptions.ImproperlyConfigured: The app module <module 'clear' from 'unknown location'> has multiple filesystem locations (['D:\\code\\huaxiang_data_pds\\dist\\clear', '\\not_existing']); you must configure this app with an AppConfig subclass with a 'path' class attribute.

打包完以后运行报错,我是打包的django项目,启动的时候报错。因为我改了app的文件结构,把里面的 __init__.py 文件删了,导致的问题。

把 __init__.py 文件加到对应的目录下重新打包就不报错了。其实 __init__.py 文件里面什么都没有。

在setting.py里面注册的所有app都需要有__init__.py文件。

 

报错四

  File "D:\software\anaconda\envs\huaxiang_pds\lib\configparser.py", line 960, in __getitem__
    raise KeyError(key)
KeyError: 'base

如果打包前运行正常、打包后运行各种问题,先考虑是不是少拷贝文件了,有些没打包的文件需要拷贝到打包目录里面才能正常运行。

 

报错五

scons: building terminated because of errors.
FATAL: Failed unexpectedly in Scons C backend compilation.
Nuitka:WARNING:     Complex topic! More information can be found at https://nuitka.net/info/scons-backend-failure.html
Nuitka-Reports: Compilation crash report written to file 'nuitka-crash-report.xml'.

这个报错是不是也正常看到?这时候就得看下你是不是起的打包程序了?把运行的打包程序或者进程停了,然后再打包试试。

 

 

分享到: