简体   繁体   English

将 python 脚本转换为 Windows 的可执行文件或图标?

[英]Convert python script to an executable file or icon for Windows?

What is the simplest tool to convert a python script into an executable file?将 python 脚本转换为可执行文件的最简单工具是什么?

I made a python script and requirements.txt which contains necessary packages for a virtual environment with python3.6.我制作了一个 python 脚本和 requirements.txt,其中包含使用 python3.6 的虚拟环境所需的包。 I gave them to my client so that he can create a virtual environment and execute the file by executing the three lines below in the console.我将它们提供给我的客户,以便他可以通过在控制台中执行以下三行来创建虚拟环境并执行文件。

source activate
python __main__.py
deactivate

Basically he needs to run it once a day, so that my python script scrapes a stock index data release at the end of each day and does some data transformation and saves the data in a desired directory as excel files.基本上他需要每天运行一次,以便我的 python 脚本在每天结束时抓取股票指数数据发布并进行一些数据转换并将数据作为 excel 文件保存在所需目录中。

However my client told me "even the three lines are difficult for people who are not familiar with CUI. Can you make it like a clickable icon?"但是我的客户告诉我“对于不熟悉 CUI 的人来说,连这三行都很难。你能把它做成一个可点击的图标吗?”

Is there any tool that can easily package my python script and required packages as an executable file or icon?是否有任何工具可以轻松地将 package 我的 python 脚本和所需的包作为可执行文件或图标? It doesn't have to be cool.它不必很酷。 A simple and primitive tool would serve our needs.一个简单而原始的工具将满足我们的需求。 My client has Windows 10 Pro 64bit but it has to be something that I can develop in my My work environment which is Mac OS Catalina.我的客户有 Windows 10 Pro 64bit 但它必须是我可以在我的工作环境 Mac OS Catalina 中开发的东西。

Thank you!谢谢!

Yes, it is possible following library's help with this.是的,可以在图书馆的帮助下解决这个问题。

PyInstaller can be used, under Mac OS X , Windows , Linux ,... PyInstaller可以在Mac OS X下使用, WindowsLinux ,...

For an example i would read this medium post , it should contain everything to get you started.举个例子,我会阅读这篇中篇文章,它应该包含让你入门的所有内容。

py2exe can be used if you only want an executable for the Windows platform.如果您只需要 Windows 平台的可执行文件,则可以使用py2exe

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

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