Yesterday我问了一个关于同时使用Excel和Python的问题。找到了解决方案:使用xlwings包。在
但是,还有一个与此相关的问题-我无法将我的.py文件保存为可执行文件(exe)。在
下面是我试图保存的代码:
在复制.py在import xlwings as xl
import numpy
import time
wb = xl.Workbook.active()
sheet = wb.active
iter = input("How many iterations do you need? \n")
i = 0
cell1 = raw_input("Write a column where you need to iterate \n")
cell2 = int(raw_input("Write a row where you need to iterate \n"))
while True:
i += 1
if i <= iter:
arg = numpy.random.uniform()
xl.Range("%s%d" % (cell1, cell2)).value = arg
else:
break
wb.save()
print("Done!")
time.sleep(2)
我尝试使用cx_freezer并使用以下代码制作了一个setup.py文件:
^{pr2}$
具有类似代码的setyp.py文件可以与其他模块一起正常工