如何在不安装解释器的情况下部署 Perl/Python/Ruby 脚本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/446685/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 20:08:34  来源:igfitidea点击:

How can I deploy a Perl/Python/Ruby script without installing an interpreter?

pythonrubyperl

提问by Brian G

I want to write a piece of software which is essentially a regex data scrubber. I am going to take a contact list in CSV and remove all non-word characters and such from the person's name.

我想编写一个软件,它本质上是一个正则表达式数据清理器。我将采用 CSV 格式的联系人列表并从该人的姓名中删除所有非单词字符等。

This project has Perl written all over it but my client base is largely non-technical and installing Perl on Windows would not be worth it for them.

这个项目到处都是 Perl,但我的客户群主要是非技术性的,在 Windows 上安装 Perl 对他们来说不值得。

Any ideas on how I can use a Perl/Python/Ruby type language without all the headaches of getting the interpreter on their computer?

关于如何使用 Perl/Python/Ruby 类型语言而不必担心在他们的计算机上安装解释器的任何想法?

Thought about web for a second but it would not work for business reasons.

考虑过网络,但出于商业原因它不起作用。

回答by Adam Bellaire

You can get Windows executables in all three languages.

您可以获得所有三种语言的 Windows 可执行文件。

回答by Tom Feiner

You can use Perl Archive Toolkitto bring a minimal perl core + needed modules + your Perl program with you.

您可以使用Perl Archive Toolkit来携带最小的 perl 核心 + 所需的模块 + 您的 Perl 程序。

And you can even convert it using PAR Packerto a windows exe file that will run just like any other program, from an end user's perspective.

从最终用户的角度来看,您甚至可以使用PAR Packer将其转换为 Windows exe 文件,该文件将像任何其他程序一样运行。

回答by pjf

Using PAR, the Perl Aachiverhas already been mentioned in other answers, and is an excellent solution. There's a short tutorial on building executables using PARthat was published as a Perl Tiplast year.

使用PAR,Perl Aachiver已经在其他答案中提到过,是一个很好的解决方案。去年作为Perl Tip发布了一个关于使用 PAR 构建可执行文件的简短教程。

In most cases, if you have PAR::Packeralready installed on your build system, you can create a stand-alone executable with no external dependencies or requirements with:

在大多数情况下,如果您的构建系统上已经安装了PAR::Packer,您可以使用以下命令创建一个没有外部依赖项或要求的独立可执行文件:

pp -o example.exe example.pl

In most cases PAR will do all the hard work of determining your module dependencies for you, but if it gets anything wrong there are additional command line options you can use to ensure they get included. See the pp documentationfor more details.

在大多数情况下,PAR 会为您完成确定模块依赖项的所有艰苦工作,但如果出现任何错误,您可以使用其他命令行选项来确保它们被包含在内。有关更多详细信息,请参阅pp 文档

All the best,

一切顺利,

Paul

保罗

回答by brian d foy

Are you sure there is a headache? ActivePerland Strawberry Perlare dead easy to install on Windows with just a couple of mouse clicks. Python is just as easy to install from what I hear.

你确定是头疼?ActivePerlStrawberry Perl非常容易在 Windows 上安装,只需点击几下鼠标。据我所知,Python 也很容易安装。

Have you tried installing any of those to see how easy it is? If those are hard for your customer, I don't see how giving them a script to run is going to be easier.

您是否尝试过安装其中任何一个以查看它有多容易?如果这些对您的客户来说很难,我看不出为他们提供运行脚本会更容易。

Or, maybe you can use something like a Docker image for Perlor provide it as a web service instead of an application.

或者,也许您可​​以使用PerlDocker 镜像之类的东西或者将其作为 Web 服务而不是应用程序提供。

回答by kgiannakakis

You could convert the script to an executable. In Python and Windows you can easily do that with py2exe. There are similar solutions for Perl and Ruby, but I believe py2exe is both free and reliable.

您可以将脚本转换为可执行文件。在 Python 和 Windows 中,您可以使用py2exe轻松做到这一点。 Perl 和 Ruby 有类似的解决方案,但我相信 py2exe 既免费又可靠。

回答by Noah

A non-technical audience? You'll also want some sort of basic user interface, probably of the `graphical' type. You might try wxPython, which can be packaged into a Windows executable with py2exeand into a Mac application with py2app.

非技术观众?您还需要某种基本的用户界面,可能是“图形”类型的。您可以尝试wxPython,它可以使用py2exe打包到 Windows 可执行文件中,并使用py2app打包到Mac 应用程序中。

回答by John

Ruby has the OCRAprogram that packages everything up into a nice neat .EXE file. The RubyScript2EXE program is no longer maintained, so this would be the better solution.

Ruby 有OCRA程序,可以将所有内容打包成一个漂亮整洁的 .EXE 文件。RubyScript2EXE 程序不再维护,因此这将是更好的解决方案。

回答by krusty.ar

Shoescan make exe's, and binaries for other platforms as well, and you get an integrated GUI.

鞋子也可以为其他平台制作 exe 和二进制文件,并且你会得到一个集成的 GUI。

回答by S.Lott

"installing Perl on Windows would not be worth it for them" Really? It's that complex?

“在 Windows 上安装 Perl 对他们来说不值得”真的吗?有那么复杂吗?

Python has a simple .MSI that neatly installs itself with no muss or fuss.

Python 有一个简单的 .MSI,可以毫不费力地自行安装。

A simple application program is just a few .py files, so, I don't see a big pain factor there.

一个简单的应用程序只是几个 .py 文件,所以,我没有看到那里有很大的痛苦因素。

You know your customers best.

您最了解您的客户。

I find that the following isn't so bad. Andit's much easier to support, since your upgrades will just be a single .MSI with simple, easy-to-live with source.

我发现以下内容还不错。 而且它更容易支持,因为您的升级只是一个带有简单、易于使用的源的单个 .MSI。

1) double click this .MSI file to install Python (or Perl or whatever)

1)双击这个 .MSI 文件安装 Python(或 Perl 或其他)

2) double click this other .MSI to install the good stuff

2) 双击另一个 .MSI 安装好东西