我无法在其他桌面上打开我的EXE文件

发布于 2025-01-25 15:44:09 字数 593 浏览 3 评论 0原文

我在Pycharm上完成了代码。现在我想将.py文件转换为.exe 我转换后。应用程序文件正在我用来转换的桌面(Desktop1)上运行,但是当我尝试在其他桌面上打开应用程序时,它会有一个错误。

`Traceback (most recent call last):
  File "main.py", line 220, in <module>
    obj = DocumentsManagementSystem(root)
  File "main.py", line 20, in __init__
    self.root.iconbitmap(r'C://Users//HP//PycharmProjects//pythonProject1//Images//senglogo.ico')
  File "tkinter\__init__.py", line 2109, in wm_iconbitmap
_tkinter.TclError: bitmap "C://Users//HP//PycharmProjects//python`

但是,当我在桌面上打开它时,它正在运行。这就是问题。我无法在其他桌面上打开它。如果您对如何解决这个问题有任何了解。我很乐意这样做。太感谢了!

I finished my code on Pycharm. Now I want to convert my .py file into .exe
After i converted it. The application file are running on the desktop (desktop1) that I used to convert, but when i try to open the application on other desktop (desktop2) it has an error that says.

`Traceback (most recent call last):
  File "main.py", line 220, in <module>
    obj = DocumentsManagementSystem(root)
  File "main.py", line 20, in __init__
    self.root.iconbitmap(r'C://Users//HP//PycharmProjects//pythonProject1//Images//senglogo.ico')
  File "tkinter\__init__.py", line 2109, in wm_iconbitmap
_tkinter.TclError: bitmap "C://Users//HP//PycharmProjects//python`

but when i open it on the desktop (desktop1) it is running. That's the issue. I cannot open it on other desktop. If you have any idea on how i can solve this. I will gladly do it. Thank you so much!

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半世晨晓 2025-02-01 15:44:09

将Pyinstaller与其他文件和add-data参数一起使用。在您的情况下,请使用此命令:

 pyinstaller --add-data  '//Users//HP//PycharmProjects//pythonProject1//Images//senglogo.ico:.' script.py

似乎您错过了在Pyinstaller流程中添加附加和数据文件。

如果您是初学者,则可以使用Pytinstaller的GUI。

PY exe所需的步骤。

  1. 分析:查找您的程序需求的文件
    https> https:https:// pyinstaller。 org/en/stable/procer-mode.html#分析finding-the-finding-files-your-program-needs

  2. 使用此命令添加所需的文件:

      pyinstaller -add-data'src/readme.txt:。' myscript.py
     

Use pyinstaller with additional file and add-data parameters. In your case use this command:

 pyinstaller --add-data  '//Users//HP//PycharmProjects//pythonProject1//Images//senglogo.ico:.' script.py

It seems like you missed adding an additional and data file in your pyinstaller process.

if you're beginner you can use the GUI of pytinstaller.
https://pypi.org/project/auto-py-to-exe/

The required steps for py to exe.

  1. Analysis: Finding the Files Your Program Needs
    https://pyinstaller.org/en/stable/operating-mode.html#analysis-finding-the-files-your-program-needs

  2. Add required file by using this command:

     pyinstaller --add-data 'src/README.txt:.' myscript.py
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文