简体   繁体   English

Python Windows Installer具有所有依赖项?

[英]Python Windows Installer with all dependencies?

I have a package in the PyPI repository. 我在PyPI存储库中有一个包。 I include a Windows installer by running the following command to upload a new version, specifically the 'bdist_wininst': 我通过运行以下命令来包含Windows安装程序以上载新版本,特别是'bdist_wininst':

python3 setup.py register sdist bdist_wininst upload

However, when a user runs the associated .exe file, it does not install Python 3 itself. 但是,当用户运行关联的.exe文件时,它不会安装Python 3本身。 Furthermore, even if Python 3 is installed, it will not install any associated dependencies. 此外,即使安装了Python 3,它也不会安装任何相关的依赖项。

What is the best way to create a windows installer that will install Python 3 if it is not installed, along with my package and its dependencies? 如果没有安装Python 3,以及我的软件包及其依赖项,那么创建安装Python 3的Windows安装程序的最佳方法是什么?

If that is not possible, what is the best way to create a windows installer that will install my package and its dependencies, assuming Python 3 is installed? 如果那是不可能的,假设安装了Python 3,创建安装我的软件包及其依赖项的Windows安装程序的最佳方法是什么?

I'm on Ubuntu 12.04. 我在Ubuntu 12.04上。 If it's of any assistance, here is my setup.py: 如果有任何帮助,这是我的setup.py:

from distutils.core import setup

import codecs 
try: 
    codecs.lookup('mbcs') 
except LookupError: 
    ascii = codecs.lookup('ascii') 
    func = lambda name, enc=ascii: {True: enc}.get(name=='mbcs') 
    codecs.register(func) 

setup(
    name='SIGACTor',
    version='0.1.14dev',
    description=open('README.txt').read(),
    url='http://bitbucket.org/davidystephenson/sigactor',
    author='David Y. Stephenson',
    author_email='david@davidystephenson.com',
    packages=['sigactor'],
    license='Proprietary',
    long_description=open('README.txt').read(),
    install_requires=[
        'beautifulsoup4',
        'feedparser',
        'python-dateutil',
        'pyyaml'
    ],
)

You should definetely try out pynsist which can bundle Python with your packages and is based on well-established NSIS open-source installer: 您应该定义一下pynsist,它可以将Python与您的软件包捆绑在一起,并且基于完善的NSIS开源安装程序:

https://pypi.python.org/pypi/pynsist https://pypi.python.org/pypi/pynsist

Anaconda team provides Constructor which is based on conda and NSIS again: Anaconda团队再次提供基于conda和NSIS的Constructor:

https://github.com/conda/constructor https://github.com/conda/constructor

Finally this approach using WinPython and most stable installer called InnoSetup: 最后这种方法使用WinPython和最稳定的安装程序名为InnoSetup:

http://cyrille.rossant.net/create-a-standalone-windows-installer-for-your-python-application/ http://cyrille.rossant.net/create-a-standalone-windows-installer-for-your-python-application/

But if your package is not a library but an application then you can bundle it (freeze) with Python and all dependencies, even compress it using pyinstaller: 但是如果你的包不是一个库而是一个应用程序,那么你可以将它(冻结)与Python和所有依赖项捆绑在一起,甚至可以使用pyinstaller压缩它:

http://www.pyinstaller.org http://www.pyinstaller.org

This is what I use for all of my apps even with crazy interop dependencies! 这就是我用于所有应用程序的内容,即使是疯狂的互操作依赖!

Bonus - auto update tool for pyinstaller: 奖金 - pyinstaller的自动更新工具:

https://github.com/JMSwag/PyUpdater https://github.com/JMSwag/PyUpdater

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

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