如何为Windows Box编写安装程序(安装python,python模块和其他依赖项)? [英] how to write installer (installing python, python modules and other dependencies) for windows boxes?

查看:81
本文介绍了如何为Windows Box编写安装程序(安装python,python模块和其他依赖项)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对此主题一无所知,但是我需要有关创建安装程序的最佳工具或方法的建议,这些程序用于安装python,一些自定义python模块,一些其他python模块(例如PIL)和一些EXE依赖项,这些都依赖于Windows计算机上的网络存储库.存储库中包含python(msi文件),PIL(exe文件),自定义python模块(pyc文件)和两个Windows可执行文件(以及exe文件和zip文件)的安装程序.任何意见欢迎.

I know nothing on this subject, but I need suggestions about the best tools or method for creating a setup program that installs python, some custom python modules, some other python modules such as PIL, and some EXE dependencies, all living on a network repository, on windows machines. In the repository are installers for python (msi file), PIL (exe file), the custom python modules (pyc files), and two windows executables (and exe file and a zip file). Any advice welcome.

推荐答案

您可以使用任何安装程序来执行此操作.每个依赖安装程序都有一个静默安装选项,因此您的安装程序只需要按正确的顺序为每个依赖项调用安装程序.我不会特别推荐任何Windows Installer应用程序,因为我不喜欢它们中的任何一个,但是它们都能满足您的需求.

You can do this with any of the installer applications out there. Each of the dependent installers has a silent install option, so your installer just needs to invoke the installers for each of the dependencies in the right order. I won't recommend any windows installer application in particular because I don't like any of them, but they will all do what you want.

您拥有的另一种选择是使用py2exe,它将所有内容捆绑到一个在自己的python环境中运行的exe文件中.好的一面是,您不必担心在用户环境中安装Python,而不必担心用户可能会卸载python,然后让您的应用停止运行,因为一切都在独立的环境中进行.

The other option you have is to use py2exe which can bundle everything into a single exe file that runs in its own python environment. The plus side to this is you don't have to worry about installing Python in the users environment and have the user potentially uninstall python and then have your app stop working because everything is in a standalone environment.

我看到的其他方式是使用自定义exe编写,该exe用您喜欢的任何已编译Windows语言编写,可以为您完成所有这些工作,但这需要大量的工作.

Other ways that I have seen this done is with a custom exe written in whatever compiled Windows Language you prefer that does all this for you, but this takes a lot of work.

通过将python.exe,dll和相关代码手动放置在安装程序中,或者使用安装程序应用程序或用于处理安装的独立exe编写的安装程序上进行一些工作,您还可以获得py2exe路由的优势.相对于您的应用程序代码的正确目录.当您的应用开始使一切正常运行时,您可能不得不弄混PYTHONPATH环境设置,但是通过这种方式,您不必担心安装Python以及用户是否已经安装了Python或是否卸载了它,因为这样您就可以您需要将Python版本与应用捆绑在一起.

You could also get the advantage of the py2exe route with a little work on an installer you write with either an installer app or a standalone exe that handles the install, by manually placing the python.exe, dll and related code in the proper directories relative to your application code. You may have to mess with your PYTHONPATH environment setting when your app starts to get everything working, but this way you don't have to worry about installing Python and whether the user already has Python installed or if they uninstall it because then you have the Python version you need bundled with your app.

要注意的一件事是,如果您担心Python安装程序本身的大小,那么它在任何依赖项之前大约为10 MB,但其中很多与使用您的应用的最终用户无关,因此没有Python Runtime Environment安装程序就像有一个Java运行时环境安装程序只是安装运行Python所需的东西一样,您总是会得到开发工具.

One thing to note is that if you are worried about size the Python installer itself is about 10 MB before any dependencies, but a lot of that is not relevant to an end user using your app, There is no Python Runtime Environment installer like there is a Java runtime Environment installer that just install what you need to run Python, you always get the development tools.

希望这会有所帮助.

这篇关于如何为Windows Box编写安装程序(安装python,python模块和其他依赖项)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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