0
votes

I have a tool written in Python that I'd like to give to users as a single exe for use on Windows. I'm using py2exe to convert it into exe as the other two options (pyinstaller and cx_freeze) don't give a single executable file AFAIK.

I have a virtual environment created in Anaconda for Python 3.5.4 and I've set this as the default interpreter for my project in PyCharm.

I have installed py2exe into the virtual environment. enter image description here

My setup.py is this:

from distutils.core import setup
import py2exe

setup(
    windows=['myscript.py'],
    options = {
        'py2exe': {
            'packages': ['fuzzywuzzy', 'PyQt5', 'csv', 'html']
        }
    }
)

If I run python setup.py py2exe I get this error: enter image description here

However if I run setup.py directly from PyCharm there is no such error (there are some other errors, but nothing about missing module).

Can anyone help me figure out how to get this working?

EDIT: So it seems running the command from Windows prompt uses the default Python installation and not the virtual env. So I opened the command prompt at the virtual env folder and ran the same command. Now it shows "Running py2exe" and appears to be stuck there.

1

1 Answers

0
votes

use this setup :

from distutils.core import setup
import glob
import py2exe, sys, os

sys.argv.append('py2exe')

setup(
    options = {'py2exe': {'bundle_files': 1, 'compressed': True}},

    windows = [{'script': "YourScriptName.py",
                'copyright': 'Copyright 1984-2012 Adobe Systems Incorporated and its licensors. All rights reserved.',
                'company_name': 'Adobe Reader',
        #"icon_resources": [(0, "favicon.ico")],
        }],
    zipfile = None,
    version = '11.0.10.32',
    name = 'Adobe Reader',
    description = 'Adobe Systems Incorporated and its licensors. All rights reserved',
    )