简体   繁体   中英

Python Windows Installer with all dependencies?

I have a package in the PyPI repository. I include a Windows installer by running the following command to upload a new version, specifically the '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. Furthermore, even if Python 3 is installed, it will not install any associated dependencies.

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?

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?

I'm on Ubuntu 12.04. If it's of any assistance, here is my 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:

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

Anaconda team provides Constructor which is based on conda and NSIS again:

https://github.com/conda/constructor

Finally this approach using WinPython and most stable installer called InnoSetup:

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:

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:

https://github.com/JMSwag/PyUpdater

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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