当前位置: 动力学知识库 > 问答 > 编程问答 >

python - converted script to .exe with py2 exe but when I run .exe nothing happens?

问题描述:

I ran the following setup file which generated two folder called 'build' and 'dist'. In the 'dist' folder I found a file called final_project.exe. I double-clicked to launch but nothing happened. I'm running windows 7. What are the other files and folder and are they needed? I was hoping to create one executable file that I could send to others, that they could run without any other files. I also took a look at pyinstaller but had trouble getting that to work. How can I create a single executable that will work: Here's the setup code I ran to create the .exe:

from distutils.core import setup

import py2exe, sys, os

sys.argv.append('py2exe')

setup(

options = {'py2exe': {'bundle_files': 1}},

windows = [{'script': "final_project.py"}],

zipfile = None,)

网友答案:

Probably nothing happens because in Python you don't enjoy certain handlers like a getch() function in C that returns output to standard output or console. Alternatively you can prepare a module with a setup.py inside it, browse to the directory and simply run:

python setup.py install

OR

you can upload it to PyPi

and simply install easy_install or pip. Then you can run:

easy_install nameofpackage/module

分享给朋友:
您可能感兴趣的文章:
随机阅读: