为什么我收到此错误。 Screenshot of error msg
它在主脚本中说python错误, 在第64行的末尾;运行时错误
import sys
#import os
from cx_Freeze import setup,Executable
base = None
if sys.platform == "win32":
base = "win32GUI"
#os.environ['TCL_LIBRARY'] = r'C:\Users\asus\AppData\Local\Programs\Python\Python36-32\tcl\tcl8.6'
#os.environ['TK_LIBRARY'] = r'C:\Users\asus\AppData\Local\Programs\Python\Python36-32\tcl\tk8.6'
setup(name="aplication",
version="0.1",
description="app",
executables=[Executable("TICTACTOE.py", base=base)])
我还是学习者,无法弄清楚这个错误
我的主脚本在shell中运行,没有错误。
这是一个脚本
import copy as c
import sys
def printBoard(arg):
i = 0
for v in arg.keys():
i += 1
if i % 3 == 0 and i < 9:
print(arg[v],'\n- + - + -')
elif i==9:
print(arg[v])
else:
print(arg[v],'','|',end=' ')
def check(b,arg):
def plagfn(b):
global looper
looper = False
plag = input('Play again? y/n ')
if plag == 'Y':
theBoard=c.copy(newBoard)
else:
sys.exit()
val = list(b.values())
l=['','','','','','','','','']
u=c.copy(l)
d=c.copy(l)
for i in [0,3,6]:
l[i] = ( val[i] == val[i+1] == val[i+2] == arg )
for i in range(3):
u[i] = ( val[i] == val[i+3] == val[i+6] == arg )
for i in [0,2]:
d[i] = ( val[i] == val[4] == val[8-i] == arg )
if ('' not in b.values()):
print('Its draw !')
plagfn(b)
if (True in l) or (True in u) or (True in d):
print(arg , 'is a winner !')
plagfn(b)
while True:
theBoard = {'TL': '', 'TM': '', 'TR': '',
'ML': '', 'MM': '', 'MR': '',
'LL': '', 'LM': '', 'LR': ''}
sample={}
for bld1 in theBoard.keys():
sample[bld1]=bld1
newBoard=c.copy(theBoard)
print('The viable inputs are \n')
printBoard(sample)
print('\nStart')
printBoard(theBoard)
looper = True
i=0
while looper:
i += 1
if i % 2 == 0:
arg = 'O'
else:
arg = 'X'
v = input('\nYour turn ' + str(arg) + '! \n')
while v not in list(theBoard.keys()):
print('The viable inputs are \n')
printBoard(sample)
v = input('\nYour turn ' + str(arg) + '! \n')
while theBoard[v] :
print('Already played.')
v = input('Your turn ' + str(arg) + '! \n')
theBoard[v]=arg
printBoard(theBoard)
check(theBoard,arg)
感谢您的时间。
答案 0 :(得分:0)
这应该有所帮助:
import sys
from cx_Freeze import setup, Executable
setup(name="aplication",
version="0.1",
description="app",
executables=[Executable("TICTACTOE.py", base="Console")])