Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使脚本中指定的代码可执行_Python_Python 3.x_Executable - Fatal编程技术网

Python 使脚本中指定的代码可执行

Python 使脚本中指定的代码可执行,python,python-3.x,executable,Python,Python 3.x,Executable,是否可以从脚本中指定数量的代码创建可执行文件 例如: #some code up here to set some things up def oneFunction(param): #does something here as well def run(): varaible1 = input() oneFunction(variable1) #more code after this if something == True: #some co

是否可以从脚本中指定数量的代码创建可执行文件

例如:

#some code up here to set some things up

def oneFunction(param):
    #does something here as well

def run():
    varaible1 = input()
    oneFunction(variable1)
    #more code after this

if something == True:
    #some code to create executable from the run function
else:
    #do something else

您可以使用cx\u freeze从py文件创建可执行文件。