A. python如何生成exe文件

编写测试代码Hello.py
[python] view plain
print "hello python!"
编写setup文件
[python] view plain
# setup.py
from distutils.core import setup
import py2exe
setup(
console = [{"script" : "Hello.py", "icon_resources" : [(1, "hello.ico")]}]
)
setup参数说明:
script:需要编译的py文件
icon_resources:生成的exe图标文件
其他参数可以自己慢慢琢磨。
目前需要解决一个问题,如果让该窗口执行完成之后不自动退出。

B. python可以将程序编程.exe执行文件吗

python生成windows下exe格式的可执行程序有三种可选方案:
py2exe是大家所熟知的,今天要介绍pyinstaller,
这个工具全版平台可用权。
曾使用python制作一个工具程序供公司同事使用后,由于公司使用mac
linux
windows都有很多,就使用过它来将程序做成可执行文件,兼容性好,只是会使得程序在linux平台和mac平台启动较慢(windows还是比较快的),但基本够用。

C. python 生成的exe 怎么运行

Python是一种简单而强大的编程语言,适用于编写脚本,甚至于应用程序的开发。Python可用的各种GUI包使得利用Python编写全功能的应用变为可能。这很好,但你有没有想过将你编写的Python脚本转化为可执行文件?这似乎是一个很赞的主意,有许多原因!你可以在没有Python解释器的情况下重新部署你的应用。终端用户不需要在他的机器上安装Python。你可以将你的应用闭源(很不幸)等等……这篇文章可以告诉你如何从你的Python脚本生成win32可执行文件。

Python is a simple and powerful language for scripting and even application development. Various GUI packages available for Python makes it suitable for developing full fledged applications in python. Ok that is fine, but ever thought of creating an executable file from the python script you wrote? This seems to be a nice idea, there are many reasons why! You can redistribute your application without python. The end user needn't to install python on his machine. You can make your application closed source (unfortunate) etc... Read on this article to find how you can create win32 executables from your Python script.

This tutorial will give step by step instruction on how to create Win32 executable from Python script. Make sure that the following are installed on your system.

这篇教程将会一步一步的介绍如何从Python脚本创建Win32可执行文件。请确保你的系统里已经安装了下面的程序。

Python. Get Python fromh and install on your machine.
py2exe. Get py2exe from 下载时注意安装的Python版本。

命令行程序

下面的示例代码会在命令行里打印一行标题,以及从1到10的数字。

test.py

print "Python script to exe test program"count = 0while count < 10:print "count = " + str(count) +" "count = count + 1123456

把这段代码保存在test.py(或者别的以.py为后缀的)文件中。用Python解释器首先测试并成功运行这段代码。要完成这一步,只需要在命令行里输入“python test.py”。你应当在命令行里看到下面的输出。

目前为止一切顺利。现在让我们看看我们怎样从脚本构建windows可执行程序。创建一个新文件命名为setup.py并将下面的代码粘贴进去。

setup.py

from distutils.core import setupimport py2exe

setup(console=['gui.py'])123

构建可执行文件时,在命令提示符里运行“python setup.py py2exe”。一旦构建过程完成,移动到dist子目录下并通过在命令行里键入“gui.exe”来运行这个可执行文件。现在你应该看到与前面用Python脚本创建的一样的窗体。

D. python 怎么执行exe程序

使用os.system函数运行其他程序
os模块中的system()函数可以方便地运行其他程序或者脚本。其函数原型如下所示。
os.system(command)
其参数含义如下所示。
command 要执行的命令,相当于在Windows的cmd窗口中输入的命令。如果要向程序或者脚本传递参数,可以使用空格分隔程序及多个参数。
以下实例实现通过os.system()函数打开系统的记事本程序。
>>> import os
# 使用os.system()函数打开记事本程序
>>> os.system('notepad')
0 # 关闭记事本后的返回值
# 向记事本传递参数,打开python.txt文件
>>> os.system('notepad python.txt')

E. 有python代码怎么编成可执行的exe程序

py2exe啊,一点也不老,稳定而且好用。
操作步骤如下:
如果你有一个名为helloworld.py的python脚本,你想把它转换为运行在windows上的可执行程序,并运行在没有安装python的windows系统上,那么首先你应写一个用于发布程序的设置脚本例如mysetup.py,在其中的setup函数前插入语句import py2exe 。
mysetup.py示例如下:
# mysetup.py
from distutils.core import setup
import py2exe

setup(console=["helloworld.py"])
然后按下面的方法运行mysetup.py:
python mysetup.py py2exe
上面的命令执行后将产生一个名为dist的子目录,其中包含了helloworld.exe,python24.dll,library.zip这些文件。
如果你的helloworld.py脚本中用了已编译的C扩展模块,那么这些模块也会被拷贝在个子目录中,同样,所有的dll文件在运行时都是需要的,除了系统的dll文件。
dist子目录中的文件包含了你的程序所必须的东西,你应将这个子目录中的所有内容一起发布。

默认情况下,py2exe在目录dist下创建以下这些必须的文件:
1、一个或多个exe文件。
2、python##.dll。
3、几个.pyd文件,它们是已编译的扩展名,它们是exe文件所需要的;加上其它的.dll文件,这些.dll是.pyd所需要的。
4、一个library.zip文件,它包含了已编译的纯的python模块如.pyc或.pyo
上面的mysetup.py创建了一个控制台的helloword.exe程序,如果你要创建一个图形用户界的程序,那么你只需要将mysetup.py中的console=["helloworld.py"]替换为windows=["myscript.py"]既可。

py2exe一次能够创建多个exe文件,你需要将这些脚本文件的列表传递给console或windows的关键字参数。如果你有几个相关联的脚本,那么这是很有用的。
运行下面个命令,将显示py2exe命令的所有命令行标记。
python mysetup.py py2exe --help

F. python怎样生成.exe执行文件

1.使用pyinstaller生成可来执行文件的方法源
1.1 将依赖文件集中到一个文件夹:
pyinstaller -D -w main.py #把main.py替换成你的主入口python文件即可。
-w参数代表main.py是一个窗体程序。
1.2 将所有依赖文件都打包到同一个可执行文件中:
pyinstaller -F -w main.py

2.调查pyinstaller生成程序的加载过程
使用如下命令,可以得到运行时的跟踪,tracing ,loader 的加载过程。
pyinstaller -Fwd aui.py #把aui.py 换成你需要侦测的文件即可。

G. 如何执行python第三方包windows exe格式

python第三方包的windows安装文件exe格式, 这上面有很多python第三方包的二进制安装文件,包括32位和64位的。下载安装就ok了!
这下面有很多python第三方包的二进制安装文件,包括32位和64位的。下载安装就ok了!

包括了mysqldb,ldap等。

Index by date:

fiona

scikit-image

netcdf4

mercurial

scikits.audiolab

numba

llvmpy

python-igraph

rpy2

numpy

opencv

zope.interface

sfepy

quantlib

gdal

imread

django

psychopy

cx_freeze

msgpack

regex

cellcognition

vigra

scikit-learn

pytables

h5py

blender-mathutils

htseq

bioformats

simplejson

pyzmq

mako

simpleitk

qimage2ndarray

ujson

vlfd

libsvm

liblinear

cgkit

scipy

distribute

noise

theano

pyalembic

openimageio

pyaudio

pymca

pyamg

pgmagick

lxml

steps

sqlalchemy

cffi

biopython

python-ldap

pycurl

nipy

nibabel

pygments

mahotas

py-postgresql

pyamf

planar

holopy

pyvisa

jcc

polymode

polygon

cython

pyropes

llist

shapely

vtk

pymongo

libpython

meshpy

pandas

umysql

epydoc

coverage

cheetah

pyrxp

pybluez

pythonmagick

bsdiff4

pymssql

pymol

boost.python

orange

requests

pywcs

python-sundials

pymix

pyminuit

pylzma

pyicu

assimulo

basemap

pygraphviz

pyproj

mpi4py

spyder

pytz

pyfits

mysql-python

pygame

pycparser

twisted

pil

qutip

openexr

nipype

python-snappy

visvis

docutils

pyhdf

pyqwt

kivy

scikits.umfpack

psycopg

ets

guiqwt

veusz

pyqt

pyside

dpmix

py-fcm

scikits.hydroclimpy

smc.freeimage

scipy-stack

ipython

nose

mxbase

numexpr

pyyaml

ode

virtualenv

aspell_python

tornado

pywavelets

bottleneck

networkx

statsmodels

pylibdeconv

pyhook

lmfit

slycot

ndimage

scikits.scattpy

cvxopt

pymc

pysparse

scikits.odes

matplotlib

vpython

pycuda

pyopencl

pymvpa

pythonnet

cld

mod_wsgi

nltk

python-levenshtein

rtree

pywin32

scientificpython

sympy

thrift

pyopengl-accelerate

mdp

pyopengl

gmpy

reportlab

natgrid

scikits.vectorplot

pyreadline

milk

blosc

pycogent

pip

gevent

scons

carray

python-dateutil

jinja2

markupsafe

jsonlib

pysfml

fonttools

silvercity

console

python-cjson

pycluster

cdecimal

pytst

autopy

sendkeys

ceodbc

fipy

psutil

pyephem

pycifrw

blist

line_profiler

pydbg

bitarray

pyglet

python-lzo

faulthandler

delny

pyexiv2

ilastik

twainmole

scitools

pyspharm

casuarius

pyodbc

greenlet

nitime

pylibtiff

mmtk

pycairo

pysqlite

curses

videocapture

bazaar

nlopt

trfit

libsbml

oursql

sphinx

cellprofiler

py2exe

re2

liblas

cgal-python

pymedia

ffnet

pyfftw

libxml-python

pyfltk

pymex

pymatlab

zodb3

mmlib

pygtk

pyserial

babel

scikits.ann

scikits.delaunay

numeric

pulp

nmoldyn

pymutt

iocbio

jpype

wxpython

pybox2d

dipy

mmseg

pynifti

scikits.samplerate

scikits.timeseries

vitables

quickfix

H. 请教python如何调用exe文件

import os
os.sysytem()
#os.startfile()

I. Python生成的exe文件不能执行

命令行类型的应用, 执行完以后会自动退出, 这个是正常的, 你可以加一个输入语句, 让他等待输入就行了
至于os和socket, 都是python自带的包, 不需要安装