ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

如何运行Nuitka编译的Python可执行文件

2019-08-24 21:56:36  阅读:567  来源: 互联网

标签:nuitka wine python ubuntu


我正在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

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有