Linux中可执行文件的不正确路径

发布于 2025-01-23 16:16:11 字数 477 浏览 3 评论 0原文

我需要在Linux中运行 exe 文件,该文件具有Python代码:

import os
dirname = os.path.normpath(os.getcwd())
print(dirname)

当我使用命令python code.py 运行代码时,它运行良好

并为我提供输出:\ root \ path \ to \ file

但是,当我尝试使用具有相同python代码的命令wine64 code.exe运行exe文件时

,它会给我输出:z:\ root \ path \ to \ file

我尝试通过添加dirname = dirname.replace('z:','')来解决它,

但是它不起作用,该怎么做?

I need to run an exe file in Linux which has the Python code:

import os
dirname = os.path.normpath(os.getcwd())
print(dirname)

When I run the code with the command python code.py , it runs fine

and gives me the output : \root\path\to\file.

But when I try to run the exe file with the command wine64 code.exe ,

which has the same python code, It gives me the output : Z:\root\path\to\file.

I tried to fix it by adding dirname = dirname.replace('Z:', ''),

but it doesn't work, How to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文