filenames - 由于“文件名或扩展名太长”,nuitka 无法生成可执行文件
问题描述
我一直在尝试使用 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
解决方案
推荐阅读
- mysql - 如何优化具有小于运算符的查询?
- python - 如何在 Python 3 中按子键日期时间对该字典进行排序
- python - tkinter Combobox:选择项目并加载相关的整数值
- ecmascript-6 - ES5/Vanila javascript 中的 object.entries
- css - 如何在 Reactjs 中的 Material-UI GridList Image 底部添加文本
- python-3.x - 可以通过单击按钮来创建列表框
- regex - 正则表达式匹配长度有限的字符串,如果存在数字数字,则不能超过 5 位
- c# - 链式方法中的 GraphQL 变异输入查询
- javascript - 在嵌入模板的 js 脚本中读取 Flask 发送的数据时获取 ReferenceError
- javascript - 映射一个数组并在里面调用异步函数