如何使用python3获取项目文件夹中的exe文件?

时间:2017-04-18 07:25:32

标签: python python-3.x

这是我项目的setup.py。我正在尝试为我的项目创建一个exe runnable。

from setuptools import setup, find_packages

setup(
    name='Call',
    version='0.1',
    packages=find_packages(),
    include_package_data=True,
    install_requires=[
        'Click',
    ],
    entry_points='''
        [console_scripts]
        call=call.scripts.call:generate_trivia
    ''',
)

每当我运行命令python setup.py install时,我都看到exe文件是在子文件夹Scripts下的Python文件夹中创建的。 我正在使用Windows 10。因此,请指导我如何将exe文件放在我的setup.py所在的文件夹中?

1 个答案:

答案 0 :(得分:0)

我刚才将.py转换为.exe时出现类似问题。最终我设法让py2exe使用它作为我的setup.py文件。

#command in cmd for py2exe
#1)get to directory
#2)enter "python setup.py py2exe"

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

sys.argv.append('py2exe')

setup(
    options = {'py2exe': {'bundle_files': 2, 'compressed': True}},
    windows = [{'script': "myProject.py"}],
    zipfile = None,
)