如何部署python脚本? [英] How to deploy python script?

查看:294
本文介绍了如何部署python脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这听起来像是一个非常开放的问题,但是我是python的狂热者,对于这个开发世界来说还很新。
我已经开发了一个python脚本,它接受输入并根据我在脚本中放置的算法给出输出。我想使用此脚本并将其打包,以便没有技术意识的最终用户可以使用它,并且只关心他们提供的输入和获得的输出。

This might sound like a very open ended question, but I am a python enthusiast, and pretty new to this world of development. I have developed a python script which takes in an input and gives an output based on the algorithm I have put in place in the script. I want to use this script and package it in a way that it can be used by end users having no technical mindset and are only concerned with input they give and the output they get.

我已经用Jupyter Notebook开发了这个复杂的代码,我想知道一种方法,如何打包或部署此代码,以便最终用户无需使用它就可以使用它。看到它是如何工作的,因为这可能会让他们不知所措。

I have used Jupyter Notebook to develop this complex code and I want to know a way about how I can package or deploy this code so that the end user can use it without seeing how it works as it might be overwhelming for them.

任何人都可以帮助我解决该问题吗?
首选Opensource。

Can anyone help me with the idea on how to do it? Something which is Opensource would be preferred.

谢谢

推荐答案

我想通过建议了几种部署Python脚本或模型的方法:

I want to round-up this question by suggesting a couple of ways to deploy Python Script or Models:


  • Docker :这是最受欢迎的方法之一在线托管脚本和部署机器学习模型的方法。您可以使用Docker容器化代码并将其托管为使用其他应用程序的微服务。

  • PEX PEX 是Twitter开发的一种聪明工具,可将Python代码作为可执行的zip文件发布。

  • AWS :使用AWS,您可以创建一个免费帐户并开始托管/部署。

  • PYSimple,Pyinstaller和Sparrow :如上面的答案所述,我们也可以使用这些软件包来完成任务。请阅读上面的内容。

  • Flask App :如果您不想使用简单的flask应用程序来使用Docker,则可以在线托管脚本。但是由于没有容器化,因此会有很多问题。最好使用Docker。

  • py2exe :如果您希望将python文件转换为Windows可执行文件,请单击此处

  • cx_Freeze :类似于py2exe,您也可以使用它

  • Docker: This is one of the most popular way of hosting scripts and deploying Machine Learning Models online. You can use Docker to containerize the code and host it as a micro service using different apps.
  • PEX: PEX is a clever tool being developed at Twitter that allows Python code to be shipped as executable zip files.
  • AWS: Using AWS, you can create a free account and get started with hosting/deployment. Lot of resources availabel online.
  • PYSimple, Pyinstaller and Sparrow: As mentioned in the answers above, we can use these packages also to do the task. Please read above.
  • Flask App: If you dont want to use Docker, using simple flask app, you will be able to host your script online. But there will be a lot of issues as its not containerized. Best to use Docker.
  • py2exe: If you are looking to convert python file into windows executable, Click here
  • cx_Freeze: Similar to the py2exe, you can use this also

不断添加更多内容,但我认为使用DOCKER是最好的方法。希望这会有所帮助。

I will keep adding more content as I find them, but I think the best way to do it using DOCKER. Hope this helps.

这篇关于如何部署python脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆