我正在编写一个Python脚本,以csv格式下载google工作表,并将工作表中的数据转换为3D打印机的特定文本文件。作为python脚本,一切都可以正常运行,但是我想将脚本与pyinstaller打包在一起,以便其他人可以使用。我的代码如下:
import numpy as np
import os as os
import requests
url = 'https://docs.google.com/spreadsheets/d/doc key goes here/export?format=csv'
r = requests.get(url)
with open('thing.csv', 'wb') as f:
f.write(r.content)
dt = np.dtype(('U', 128))
dirName = input('What would you like to call the folder?')
if not os.path.exists(dirName):
os.mkdir(dirName)
print("Directory " , dirName , " Created ")
else:
print("Directory " , dirName , " already exists")
file = open('thing.csv')
data = np.genfromtxt(file, delimiter=",",dtype=dt)
data1 = data
headers=data[[0,1],:]
data = np.delete(data,(0,1),0) #delete rows
titles=data[:,0]
data = np.delete(data, 0,1) #delete columns
r,c=np.shape(data)
profs = np.zeros((r,c))
profs = np.array(profs,dtype=dt)
for i in range(r):
for j in range(c):
if i in (0,4,5,12,13):
profs[i,j]=titles[i]
else:
profs[i,j]=titles[i]+' = '+data[i,j]
for k in range(c):
varient=data[11,k]
varient=varient.replace(' ','_')
filename = dirName + '/' + data[10,k] + '_' + varient + '_' + data[8,k]+'.inst.cfg'
np.savetxt(filename, profs[:,k], newline='\n',fmt='%s')
当我运行pyinstaller时,会发生以下情况:
73 INFO: PyInstaller: 3.5.dev0+0ffa574bf
74 INFO: Python: 3.6.5
76 INFO: Platform: Darwin-18.0.0-x86_64-64bit
77 INFO: wrote /Users/Zach/Desktop/Hydra/Cura/PythonScript/quality/Running/QualityMaker.spec
80 INFO: UPX is not available.
82 INFO: Extending PYTHONPATH with paths
['/Users/Zach/Desktop/Hydra/Cura/PythonScript/quality/Running',
'/Users/Zach/Desktop/Hydra/Cura/PythonScript/quality/Running']
82 INFO: checking Analysis
82 INFO: Building Analysis because Analysis-00.toc is non existent
82 INFO: Initializing module dependency graph...
86 INFO: Initializing module graph hooks...
88 INFO: Analyzing base_library.zip ...
Execution failed: [Errno 2] No such file or directory: 'arch': 'arch'
我无法在线找到任何文档来解决此问题,如果有人可以提供帮助,我将不胜感激!