gcc编译python可执行_如何运行Nuitka编译的Python可执行文件
我正在Ubuntu 14.04上試驗Nuitka并嘗試創建并運行可執行文件.我有一個文件hello.py與內容
print("Hello please")
我使用命令nuitka hello.py將其轉換為hello.exe.但是,當我嘗試使用Wine 1.7運行它時,我得到以下錯誤:
$wine hello.exe
wine: Bad EXE format for Z:\home\crclayton\hello.exe.
我認為這是Nuitka的問題,而不是Wine,因為我可以使用Wine來運行我在C#中創建的helloworld.exe.有誰知道如何修理它?
編輯:
我在Ubuntu上沒有運氣,所以我測試了我的Windows 7分區上的hello.exe(Ubuntu和Windows都是64位),我收到以下錯誤:
The version of this file is not compatible with the version of windows you’re running. Check your computer’s system information to see whether you need an x86 (32 bit) or x64 (64 bit) version of the program, and then contact the software publisher.
問題是Nuitka正在創建一個32位的exe并且我試圖在64位操作系統上運行它嗎?如果是這樣,任何人都知道如何解決它?
解決方法:
根據Nuitka手冊
The resulting filename will be program.exe on all platforms, that doesn’t mean it doesn’t run on non-Windows! But if you compile program we wouldn’t want to overwrite it, or be unsure which one is the compiled form, and which one is not.
如果你在Ubuntu上運行nuitka hello.py(以及因此gccELF)你將創建hello.exe`但是只有linux的ELF可執行文件
如果你在Windows上運行nuitka hello.py(以及gcc / PE),你將創建hello.exe但是一個只有windows的PE可執行文件(可以通過WINE在linux中執行)
Nuitka,Cython,cx_freeze不會生成與操作系統無關的可執行文件,但提供了為特定操作系統構建的方法
你正試圖做兩件事之一
1)在windows中構建linux.如果是這種情況,你需要配置交叉編譯或在WINE中進行最終構建(即安裝到wine:python,nuitika,gcc …)
2)你在Linux中構建linux. chmod x hello.exe; ./hello.exe#然后可能重命名.
標簽:nuitka,wine,python,ubuntu
來源: https://codeday.me/bug/20190824/1712360.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的gcc编译python可执行_如何运行Nuitka编译的Python可执行文件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 绿建科技加密图纸查看器安装_施工图看不懂
- 下一篇: websocket python爬虫_p