简体   繁体   English

如何将文件 from.exe 存储在所需的文件夹中?

[英]How to store file from .exe in desired folder?

I have a python script, which I have successfully converted to.exe file using pyinstaller.我有一个 python 脚本,我已经使用 pyinstaller 成功地将其转换为 .exe 文件。 Somehow, the icon doesn't show up, if I could get some help/tip w/ that.不知何故,图标没有出现,如果我能得到一些帮助/提示的话。 It was stored as.icns file as I work on a mac.当我在 Mac 上工作时,它被存储为 .icns 文件。

Main issue here is, my python script writes a.csv file.这里的主要问题是,我的 python 脚本写入了一个.csv 文件。 When I run the.exe file, the csv saves to the main user folder, and not the same folder as the exe file.当我运行 .exe 文件时,csv 保存到主用户文件夹,而不是与 exe 文件相同的文件夹。 How do I solve this?我该如何解决这个问题? I have tried googling and every other method, but doesn't work.我尝试过谷歌搜索和其他所有方法,但不起作用。

One solution is to direct to the folder using command-line and then type './file.exe'.一种解决方案是使用命令行定向到该文件夹,然后键入“./file.exe”。 But I am really looking for an option, which gets this done by default但我真的在寻找一个选项,它默认完成

While saving the.csv file, you can use os.getcwd()+'/file.csv'.在保存 .csv 文件时,可以使用 os.getcwd()+'/file.csv'。 Hope this might help.希望这可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM