简体   繁体   English

将Python(3.5.2)文件转换为exe?

[英]Convert a Python (3.5.2) File into an exe?

is there any surefire way to convert a Python (3.5.2) File into an exe? 有什么surefire方法可以将Python(3.5.2)文件转换为exe? I have seen Pyinstaller, py2exe and cx_Freeze. 我见过Pyinstaller,py2exe和cx_Freeze。 cx_Freeze does not have a Python 3.5 version, only 3.4 so it isnt compatible. cx_Freeze没有Python 3.5版本,只有3.4,因此不兼容。 Py2exe works only for Python 2 and while I had some success with Pyinstaller, it returned an error relating to 9130 WARNING: hidden import "pygame._view" not found! Py2exe仅适用于Python 2,尽管我在Pyinstaller上取得了一些成功,但它返回了与9130有关的错误警告:找不到隐藏的导入“ pygame._view”! (the only one as I can see). (我所看到的唯一一个)。

The exe. 的exe。 file was created but malfunctioned and stopped working. 文件已创建,但出现故障并停止工作。

Any advice? 有什么建议吗?

I used py2exe to convert python 3 files to exe files. 我用py2exe将python 3文件转换为exe文件。 I haven't tested with version 3.5 but this website says that this version of py2exe works with any python 3 versions. 我尚未使用3.5版进行测试,但该网站说py2exe的该版本可与任何python 3版本一起使用。

  1. Download and install py2exe 下载并安装py2exe
  2. Navigate to your python folder. 导航到您的python文件夹。
  3. Create new text file called setup. 创建一个名为setup的新文本文件。
  4. Insert these commands: from distutils.core import setup 插入以下命令:从distutils.core导入设置
    import py2exe 导入py2exe
    setup(console=['nameofyourpyfile.py']) 设置(控制台= ['nameofyourpyfile.py'])
  5. Close the text file and open cmd. 关闭文本文件并打开cmd。
  6. Navigate to your python folder using command cd. 使用命令cd导航到您的python文件夹。
  7. Enter this command: python setup.txt py2exe 输入此命令:python setup.txt py2exe
  8. Press enter and your done navigate to folder called dist and find your exe file. 按Enter键,然后完成导航到名为dist的文件夹并找到您的exe文件。
  9. If it doesn't work install program called pywin32 and try again. 如果不起作用,请安装名为pywin32的程序,然后重试。 If pywin32 doesn't help then let me know I will help you for sure :D 如果pywin32不能解决问题,请告诉我,我会帮助您的:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM