gpt4 book ai didi

python - Pyinstaller sys.executable复制目录时出错

转载 作者:行者123 更新时间:2023-12-01 06:31:57 25 4
gpt4 key购买 nike

我已经构建了一个应用程序并将其与 Windows 上的 pyinstaller 捆绑在一起现在我想通过调用

访问卡住应用程序的目录
installdir = os.path.dirname(sys.executable)

这对我来说效果很好,除非我将整个目录复制到不同的位置

然后我的安装目录变成这样:

X:\Users\<user>\ZOMB~S0!

它应该是这样的:

X:\Users\<user>\Zombie_2020_01_22_17_09_25_PSL

有人知道是什么原因导致这种行为吗?

最佳答案

没关系找到答案。 Windows 只是缩短了路径。要获取完整路径,我可以使用

installDir = win32api.GetLongPathName(os.path.dirname(sys.executable))

关于python - Pyinstaller sys.executable复制目录时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59864273/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com