安装文件不能安装在其他电脑上
Setup file cannot be installed on other computers
我使用 nsis 创建了一个安装程序文件。 运行 在我的系统上运行该程序后,它运行完美,但在第三方系统上安装时,它在启动该应用程序时抱怨。
Traceback (most recent call last):
File "Classify.py", line 20, in <module>
File "tkinter\_init_.py", line 2109, in wm_iconbitmap
_tkinter.TclError: bitmap "D:\Users\Engr M2J\Documents\GitHub\HAM1000-Image-Classifier\logo.ico" not defined
我知道这是错误的来源;
root.title("HAM10000 Image Classifier by Engr. Sule Muhammed Abba- BookNowNow Code version 1.1.0")
root.iconbitmap(r'D:\Users\Engr M2J\Documents\GitHub\HAM1000-Image-Classifier\logo.ico')
它实际上是在引用我的计算机路径,而不是相对路径。这是我可以通过使用它的直接路径加载图标的唯一方法。每当我使用下面的代码时,我都会收到以下错误;
root.iconbitmap('logo.ico')
我收到这个错误
return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "logo.ico" not defined
请协助
以下是解决问题的步骤。
我打印了工作目录。
print(getcwd())
然后我将所有代码文件复制到这个目录
通过这样做,我能够使用
加载图标
root.iconbitmap(r'logo.ico')
我的新软件现在可以在不同的系统上无缝运行,没有任何抱怨。
欢迎任何更好的解决方案,但这将完美运行。
我使用 nsis 创建了一个安装程序文件。 运行 在我的系统上运行该程序后,它运行完美,但在第三方系统上安装时,它在启动该应用程序时抱怨。
Traceback (most recent call last):
File "Classify.py", line 20, in <module>
File "tkinter\_init_.py", line 2109, in wm_iconbitmap
_tkinter.TclError: bitmap "D:\Users\Engr M2J\Documents\GitHub\HAM1000-Image-Classifier\logo.ico" not defined
我知道这是错误的来源;
root.title("HAM10000 Image Classifier by Engr. Sule Muhammed Abba- BookNowNow Code version 1.1.0")
root.iconbitmap(r'D:\Users\Engr M2J\Documents\GitHub\HAM1000-Image-Classifier\logo.ico')
它实际上是在引用我的计算机路径,而不是相对路径。这是我可以通过使用它的直接路径加载图标的唯一方法。每当我使用下面的代码时,我都会收到以下错误;
root.iconbitmap('logo.ico')
我收到这个错误
return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "logo.ico" not defined
请协助
以下是解决问题的步骤。
我打印了工作目录。
print(getcwd())
然后我将所有代码文件复制到这个目录
通过这样做,我能够使用
加载图标root.iconbitmap(r'logo.ico')
我的新软件现在可以在不同的系统上无缝运行,没有任何抱怨。
欢迎任何更好的解决方案,但这将完美运行。