我一直在尝试使用 nuitka 编译/生成独立的可执行文件(.exe),但每次都失败并显示以下消息:
Nuitka:INFO: 运行 scons 前的总内存使用量:2.72 GB(2920177664 字节):scons: *** [main_executable.dist\main_executable.exe] 文件名或扩展名太长
我是这个编程的新手,但我想我已经尝试了几乎所有的东西。我将 *.py 文件移动到目录 C:\main 以缩短路径无济于事。我已重命名文件以从“main_executable”生成“main.exe”,但无济于事。
我的 python 安装在这里:'C:\users\test\Anaconda3...'
我在下面遇到了这个函数来缩短路径,但我不知道如何实现它:(取自http://code.activestate.com/recipes/286179-getshortpathname/)
你能帮忙吗?谢谢。
def getShortPathName(filepath):
"Converts the given path into 8.3 (DOS) form equivalent."
import win32api, os
if filepath[-1] == "\\":
filepath = filepath[:-1]
tokens = os.path.normpath(filepath).split("\\")
if len(tokens) == 1:
return filepath
ShortPath = tokens[0]
for token in tokens[1:]:
PartPath = "\\".join([ShortPath, token])
Found = win32api.FindFiles(PartPath)
if Found == []:
raise WindowsError, 'The system cannot find the path specified: "%s"' % (PartPath)
else:
if Found[0][9] == "":
ShortToken = token
else:
ShortToken = Found[0][9]
ShortPath = ShortPath + "\\" + ShortToken
return ShortPath