英文:
How can I fix the fatal error C1060 that occurs when using Nuitka to compile .py to .exe?
问题
在编译.py
文件为.exe
时出现错误C1060,如何解决这个问题?
Nuitka命令:
nuitka --onefile --jobs=4 --disable-ccache --plugin-enable=pyqt5 --windows-icon-from-ico=youtube-downloader-icon.ico downloader.py
完整的终端输出:
E:\code\PycharmProjects\pythonProject\YOUTUBE_DOWNLOADER_2>nuitka --onefile --jobs=4 --disable-ccache --plugin-enable=pyqt5 --windows-icon-from-ico=youtube-downloader-icon.ico downloader.py
Nuitka-Options:INFO: 使用的命令行选项:--onefile --jobs=4 --disable-ccache --plugin-enable=pyqt5 --windows-icon-from-ico=youtube-downloader-icon.ico downloader.py
Nuitka:WARNING: Python版本 '3.11' 仅在 Nuitka '1.5.4' 中实验性支持,但即将发布的版本
Nuitka:WARNING: 将更改此支持。同时,请使用 Python 版本 '3.10' 或更新的 Nuitka。
Nuitka-Plugins:WARNING: pyqt5: 对于已过时的 PyQt5,Nuitka 的支持不完整。线程,对编译的回调
Nuitka-Plugins:WARNING: 函数等可能无法正常工作。
Nuitka-Plugins:WARNING: 复杂的话题!更多信息可以在 https://nuitka.net/info/pyqt5.html 找到
Nuitka:INFO: 在 Python '3.11' 上使用 Nuitka '1.5.4' 开始编译商业级别 '未安装'。
Nuitka-Plugins:INFO: pyqt5: 为模块 'PyQt5' 注入前模块加载代码:
Nuitka-Plugins:INFO: pyqt5: 将二进制文件夹添加到运行时 'PATH' 环境变量以正确加载 Qt。
Nuitka-Plugins:INFO: pyqt5: 为模块 'PyQt5.QtCore' 注入后模块加载代码:
Nuitka-Plugins:INFO: pyqt5: 将 Qt 库路径设置为分发文件夹。我们需要避免加载目标
Nuitka-Plugins:INFO: pyqt5: 系统 Qt 插件,这可能来自另一个 Qt 版本。
Nuitka-Plugins:INFO: multiprocessing: 为模块 'multiprocessing' 注入前模块加载代码:
Nuitka-Plugins:INFO: multiprocessing: 修补 'multiprocessing' 加载环境。
Nuitka-Plugins:INFO: multiprocessing: 为模块 'multiprocessing' 注入后模块加载代码:
Nuitka-Plugins:INFO: multiprocessing: 修补 'multiprocessing' 以用于编译的方法。
Nuitka-Plugins:INFO: pkg-resources: 为模块 'pkg_resources' 注入后模块加载代码:
Nuitka-Plugins:INFO: pkg-resources: 使用 'pkg_resources' 注册 Nuitka 加载器。
Nuitka-Plugins:INFO: options-nanny: 注意,使用 'PyQt5' 时,请考虑使用 '--disable-console' 选项。否则,将打开一个终端窗口。但是,对于调试,终端输出是查看信息丰富的回溯信息的最简单方法。
Nuitka:INFO: 完成 Python 级别的编译和优化。
Nuitka:INFO: 为 C 后端编译器生成源代码。
Nuitka:INFO: 运行数据组合器工具以实现最佳常量值处理。
Nuitka:INFO: 通过 Scons 运行 C 编译。
Nuitka-Scons:INFO: 后端 C 编译器:cl (cl 14.3)。
Nuitka-Scons:INFO: 检测到较慢的 C 编译,到目前为止使用了 60 秒,可伸缩性问题。
此命令的意外输出:
此命令的意外输出:
cl /Fomodule.yt_dlp.extractor.youtube.obj /c "module.yt_dlp.extractor.youtube.cpp" /TP /nologo /Ox /GF /Gy /EHsc /J /Gd /bigobj /MT /D__NUITKA_NO_ASSERT__ /D_NUITKA_STANDALONE /D_NUITKA_ONEFILE_MODE /D_NUITKA_ONEFILE_TEMP_BOOL /D_NUITKA_CONSTANTS_FROM_RESOURCE /D_NUITKA_FROZEN=155 /D_NUITKA_EXE /D_NUITKA_PLUGIN_MULTIPROCESSING_ENABLED=1 /IE:\code\Python\include /I. /IE:\code\Python\Lib\site-packages\nuitka\build\include /IE:\code\Python\Lib\site-packages\nuitka\build\static_src
cl /Fomodule.yt_dlp.extractor.zattoo.obj /c "module.yt_dlp.extractor.zattoo.cpp" /TP /nologo /Ox /GF /Gy /EHsc /J /Gd /bigobj /MT /D__NUITKA_NO_ASSERT__ /D_NUITKA_STANDALONE /D_NUITKA_ONEFILE_MODE /D_NUITKA_ONEFILE_TEMP_BOOL /D_NUITKA_CONSTANTS_FROM_RESOURCE /D_NUITKA_FROZEN=155 /D_NUITKA_EXE /D_NUITKA_PLUGIN_MULTIPROCESSING_ENABLED=1 /IE:\code\Python\include /I. /IE:\code\Python\Lib\site-packages\nuitka\build\include /IE:\code\Python\Lib\site-packages\nuitka\build\static_src
module.yt_dlp.extractor.youtube.cpp(127845): fatal error C1060: Є®¬ЇЁ«пв®аг ­Ґ еў в Ґв а §¬Ґа  ЄгзЁ
scons: *** [module.yt_dlp.extractor.youtube.obj] Error 2
module.yt_dlp.extractor.zattoo.cpp(46870): fatal error C1060: Є®¬ЇЁ«пв®аг ­Ґ еў в Ґв а §¬Ґа  ЄгзЁ
后端 C: 97.6%|████████████████████████▍| 1197/1227scons: *** [module.yt_dlp.extractor.zattoo.obj] Error 2
Nuitka-Scons:INFO: 运行 'cl /Fomodule.yt_dlp.extractor.lazy
<details>
<summary>英文:</summary>
At the end of compiling the .py file in .exe error C1060 occurs, how to solve this problem?
Nuitka command:
nuitka --onefile --jobs=4 --disable-ccache --plugin-enable=pyqt5 --windows-icon-from-ico=youtube-downloader-icon.ico downloader.py
Full terminal output:
E:\code\PycharmProjects\pythonProject\YOUTUBE_DOWNLOADER_2>nuitka --onefile --jobs=4 --disable-ccache --plugin-enable=pyqt5 --windows-icon-from-ico=youtube-downloader-icon.ico downloader.py
Nuitka-Options:INFO: Used command line options: --onefile --jobs=4 --disable-ccache --plugin-enable=pyqt5 --windows-icon-from-ico=youtube-downloader-icon.ico downloader.py
Nuitka:WARNING: The Python version '3.11' is only experimentally supported by Nuitka '1.5.4', but an upcoming release
Nuitka:WARNING: will change that. In the mean time use Python version '3.10' instead or newer Nuitka.
Nuitka-Plugins:WARNING: pyqt5: For the obsolete PyQt5 the Nuitka support is incomplete. Threading, callbacks to compiled
Nuitka-Plugins:WARNING: functions, etc. may not be working.
Nuitka-Plugins:WARNING: Complex topic! More information can be found at https://nuitka.net/info/pyqt5.html
Nuitka:INFO: Starting Python compilation with Nuitka '1.5.4' on Python '3.11' commercial grade 'not installed'.
Nuitka-Plugins:INFO: pyqt5: Injecting pre-module load code for module 'PyQt5':
Nuitka-Plugins:INFO: pyqt5: Adding binary folder to runtime 'PATH' environment variable for proper Qt loading.
Nuitka-Plugins:INFO: pyqt5: Injecting post-module load code for module 'PyQt5.QtCore':
Nuitka-Plugins:INFO: pyqt5: Setting Qt library path to distribution folder. We need to avoid loading target
Nuitka-Plugins:INFO: pyqt5: system Qt plugins, which may be from another Qt version.
Nuitka-Plugins:INFO: multiprocessing: Injecting pre-module load code for module 'multiprocessing':
Nuitka-Plugins:INFO: multiprocessing: Monkey patching "multiprocessing" load environment.
Nuitka-Plugins:INFO: multiprocessing: Injecting post-module load code for module 'multiprocessing':
Nuitka-Plugins:INFO: multiprocessing: Monkey patching "multiprocessing" for compiled methods.
Nuitka-Plugins:INFO: pkg-resources: Injecting post-module load code for module 'pkg_resources':
Nuitka-Plugins:INFO: pkg-resources: Registering Nuitka loader with "pkg_resources".
Nuitka-Plugins:INFO: options-nanny: Note, when using 'PyQt5', consider using '--disable-console' option. Otherwise a terminal window will open. However for debugging, terminal output is the easiest way to see informative traceback information.
Nuitka:INFO: Completed Python level compilation and optimization.
Nuitka:INFO: Generating source code for C backend compiler.
Nuitka:INFO: Running data composer tool for optimal constant value handling.
Nuitka:INFO: Running C compilation via Scons.
Nuitka-Scons:INFO: Backend C compiler: cl (cl 14.3).
Nuitka-Scons:INFO: Slow C compilation detected, used 60s so far, scalability problem.
Unexpected output from this command:
Unexpected output from this command:
cl /Fomodule.yt_dlp.extractor.youtube.obj /c "module.yt_dlp.extractor.youtube.cpp" /TP /nologo /Ox /GF /Gy /EHsc /J /Gd /bigobj /MT /D__NUITKA_NO_ASSERT__ /D_NUITKA_STANDALONE /D_NUITKA_ONEFILE_MODE /D_NUITKA_ONEFILE_TEMP_BOOL /D_NUITKA_CONSTANTS_FROM_RESOURCE /D_NUITKA_FROZEN=155 /D_NUITKA_EXE /D_NUITKA_PLUGIN_MULTIPROCESSING_ENABLED=1 /IE:\code\Python\include /I. /IE:\code\Python\Lib\site-packages\nuitka\build\include /IE:\code\Python\Lib\site-packages\nuitka\build\static_src
cl /Fomodule.yt_dlp.extractor.zattoo.obj /c "module.yt_dlp.extractor.zattoo.cpp" /TP /nologo /Ox /GF /Gy /EHsc /J /Gd /bigobj /MT /D__NUITKA_NO_ASSERT__ /D_NUITKA_STANDALONE /D_NUITKA_ONEFILE_MODE /D_NUITKA_ONEFILE_TEMP_BOOL /D_NUITKA_CONSTANTS_FROM_RESOURCE /D_NUITKA_FROZEN=155 /D_NUITKA_EXE /D_NUITKA_PLUGIN_MULTIPROCESSING_ENABLED=1 /IE:\code\Python\include /I. /IE:\code\Python\Lib\site-packages\nuitka\build\include /IE:\code\Python\Lib\site-packages\nuitka\build\static_src
module.yt_dlp.extractor.youtube.cpp(127845): fatal error C1060: Є®¬ЇЁ«пв®аг Ґ еў в Ґв а §¬Ґа ЄгзЁ
scons: *** [module.yt_dlp.extractor.youtube.obj] Error 2
module.yt_dlp.extractor.zattoo.cpp(46870): fatal error C1060: Є®¬ЇЁ«пв®аг Ґ еў в Ґв а §¬Ґа ЄгзЁ
Backend C: 97.6%|████████████████████████▍| 1197/1227scons: *** [module.yt_dlp.extractor.zattoo.obj] Error 2
Nuitka-Scons:INFO: Running 'cl /Fomodule.yt_dlp.extractor.lazy_extractors.obj /c "module.yt_dlp.extractor.lazy_extractors.cpp" /TP /nologo /Ox /GF /Gy /EHsc /J /Gd /bigobj /MT /D__NUITKA_NO_ASSERT__ /D_NUITKA_STANDALONE /D_NUITKA_ONEFILE_MODE /D_NUITKA_ONEFILE_TEMP_BOOL /D_NUITKA_CONSTANTS_FROM_RESOURCE /D_NUITKA_FROZEN=155 /D_NUITKA_EXE /D_NUITKA_PLUGIN_MULTIPROCESSING_ENABLED=1 /IE:\code\Python\include /I. /IE:\code\Python\Lib\site-packages\nuitka\build\include /IE:\code\Python\Lib\site-packages\nuitka\build\static_src' took 262.56 seconds
Unexpected output from this command:
cl /Fomodule.yt_dlp.extractor.lazy_extractors.obj /c "module.yt_dlp.extractor.lazy_extractors.cpp" /TP /nologo /Ox /GF /Gy /EHsc /J /Gd /bigobj /MT /D__NUITKA_NO_ASSERT__ /D_NUITKA_STANDALONE /D_NUITKA_ONEFILE_MODE /D_NUITKA_ONEFILE_TEMP_BOOL /D_NUITKA_CONSTANTS_FROM_RESOURCE /D_NUITKA_FROZEN=155 /D_NUITKA_EXE /D_NUITKA_PLUGIN_MULTIPROCESSING_ENABLED=1 /IE:\code\Python\include /I. /IE:\code\Python\Lib\site-packages\nuitka\build\include /IE:\code\Python\Lib\site-packages\nuitka\build\static_src
module.yt_dlp.extractor.lazy_extractors.cpp(469234): fatal error C1060: Є®¬ЇЁ«пв®аг Ґ еў в Ґв а §¬Ґа ЄгзЁ
Backend C: 97.7%|████████████████████████▍| 1199/1227scons: *** [module.yt_dlp.extractor.lazy_extractors.obj] Error 2
</details>
# 答案1
**得分**: 0
你好,我认为这将有所帮助。
尝试使用Python 3.10.1版本,并重新安装Nuitka。
然后尝试执行以下命令:
```python -m nuitka --onefile --include-package=PyQt5 --include-package-data=PyQt5 --follow-imports --enable-plugin=pyqt5 --include-qt-plugins=all main.py```
<details>
<summary>英文:</summary>
hello i think this will help
try python 3.10.1
and reinstall nuitka
and try this commend :
python -m nuitka --onefile --include-package=PyQt5 --include-package-data=PyQt5 --follow-imports --enable-plugin=pyqt5 --include-qt-plugins=all main.py
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论