我正在尝试将python脚本转换为独立的可执行文件,它会在"error: invalid command 'bdist'"
停止使用cx_freeze以及py安装程序。
我找不到这个错误的含义,你有什么建议吗?
根据评论中的要求,这是主要代码,在Renaming_variables2
中调用外部文件,如果我不添加该文件则会出错。我认为这意味着exe运行至少直到该行。然后,当我将外部文件添加到其请求的位置时,将删除该文件丢失错误并显示bdist
错误。没有任何线条指示。
#Define variables
#Parameters:
import psutil
import os
import sys
import shutil
import time
print("the directory of the python installation = ", os.path)
print("the working directory of this project = ", os.getcwd())
print("the directory of this py = ", os.path.dirname(os.path.realpath(__file__)))
breaktime = 11
refresh_time = 2
nr_of_task_scheduler_commands = list()
for i in range(0,2):
nr_of_task_scheduler_commands.append(False)
name_check_md = "d.py"
convert_name_check_md = "Convert_d_py2exe.py"
path_name_check_md_and_conversion = "a/"
file_path = os.path.dirname(os.path.realpath(__file__))
file_path =file_path .replace('\\','/')
name_run_check = "ma.py"
convert_run_check = "Convert_s_py2exe.py"
path_run_check_and_conversion = "b/"
path_task = "task"
path_task_adm = "/adm"
name_original_task = "task.xml"
name_task = "task.xml"
temp_name_task = "taskq.xml"
adm_run_bat = "RunAsAdminConsole.bat"
output_adm= "/output_adm"
add_task_bat = "callrunasadminconsole4.bat"
import getpass
user_name = getpass.getuser()
import socket
domain = socket.getfqdn()
destination_path = "C:/out"
parent_output = 'output'
parent_dist = 'dist/'
#Not replaced below
name_check_md_exe = "ds.exe"
#Not replaced below
path_check_md_exe = "a/dist/"
name_run_check_exe = "dc.exe"
#Not replaced below
path_run_check_exe = "b/dist/"
#Not replaced below
path_min = "sx"
path_gmin = "dr"
md_output = "output.txt"
import getpass
print getpass.getuser()
#check if folder exists and if not, create it
if not os.path.exists(destination_path):
print destination_path + " is not an existing path"
# 1.0 if non-existant goto step 2
# 1.1 if existant: go to step 3.
# 2. read manual path from: "path.txt"
destination_path = raw_input("Please enter a new system path ")
# 3. feed path into Renaming_variables.py
# 4. run Renaming_variables.py
# Disable printing
def blockPrint():
sys.stdout = open(os.devnull, 'w')
import Renaming_variables2
# 5. run callerY.py
import caller5
os.chdir(file_path +'/'+ path_task+path_task_adm)
os.startfile("RunAsAdminConsole.bat")
#1.a #first delete destination file from /task if it exists
def deletion(file_path, old_file_name):
try:
# delete all files in folder
file_and_folder_path = os.path.join(file_path, old_file_name)
os.remove(file_and_folder_path)
except:
pass
deletion(file_path +'/'+ path_task,"RunAsAdminConsole.exe")
#1.b #then move file to /task
time.sleep(10)
shutil.move(file_path +'/'+ path_task+path_task_adm+output_adm+'/'+"RunAsAdminConsole.exe" , file_path +'/'+ path_task+'/')
os.chdir(file_path +'/'+ path_task+'/')
os.startfile("callrunasadminconsole4.bat")
但是,我想强调的是,这个问题不是解决这个问题,这个问题是关于以下错误信息的含义:
error: invalid command 'bdist'