微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我正在尝试将python文件转换为exe文件,但无法正常工作

如何解决我正在尝试将python文件转换为exe文件,但无法正常工作

我尝试使用java.awt.graphicsenv sun.awt.X11GraphicsEnvironment java.awt.headless true java.awt.printerjob sun.print.PSPrinterJob java.class.path /usr/share/jenkins/jenkins.war java.class.version 52.0 java.endorsed.dirs /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/jre/lib/endorsed java.ext.dirs /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/jre/lib/ext:/usr/java/packages/lib/ext java.home /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/jre java.io.tmpdir /tmp java.library.path /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib java.runtime.name OpenJDK Runtime Environment java.runtime.version 1.8.0_262-b10 java.specification.name Java Platform API Specification java.specification.vendor Oracle Corporation java.specification.version 1.8 java.vendor Oracle Corporation java.vendor.url http://java.oracle.com/ java.vendor.url.bug http://bugreport.sun.com/bugreport/ java.version 1.8.0_262 java.vm.info mixed mode java.vm.name OpenJDK 64-Bit Server VM java.vm.specification.name Java Virtual Machine Specification java.vm.specification.vendor Oracle Corporation java.vm.specification.version 1.8 java.vm.vendor Oracle Corporation java.vm.version 25.262-b10 将python文件制作为exe文件 。尝试从dist打开exe时出现错误,因此我使用了pyinstaller main.py --onefile --noconsole并说--debug=all

我第一次不确定我到底是怎么做的。

解决方法

要将python文件转换为exe:

  1. 确保已安装pyinstaller并保持最新状态

    pip install pyinstaller

  2. 在PowerShell中键入以下内容:

    pyinstaller --onefile -w 'youfilename.py'

文件名应显示为1.exe 确保位于正确的目录中

如果您有更多疑问,请使用以下链接:https://www.geeksforgeeks.org/convert-python-script-to-exe-file/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。