[英]Windows Error 3 : The system cannot find the path specified pyinstaller
I have converted a .py file to an .exe file.我已将 .py 文件转换为 .exe 文件。 When I run the .exe file on my computer it works well.当我在计算机上运行 .exe 文件时,它运行良好。 When I try another PC it does not work.当我尝试另一台 PC 时,它不起作用。 It says Line 16 by the way.顺便说一句,它说的是第 16 行。 First block below is my code.下面的第一个块是我的代码。 Second one is the error.第二个是错误。
import sys, os
def resource_path(relative_path):
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)
return os.path.join(os.path.abspath("."), relative_path)
from tkinter import *
from tkinter.filedialog import *
from PIL import ImageTk, Image
import numpy as np
import numpy.random.common
import numpy.random.bounded_integers
import numpy.random.entropy
import pandas as pd
# Change working directory
pathwd = "E:\\Desktop\\tkinter final backups\\Machine Learning Implementing Program"
os.chdir(pathwd)
WindowsError: [Error 3] The system cannot find the path specified: 'E:\\Desktop\\tkinter final backups\\Machine Learning Implementing Program' WindowsError: [错误 3] 系统找不到指定的路径:'E:\\Desktop\\tkinter final backups\\Machine Learning Implementation Program'
可能是因为另一个系统与您的系统没有相同的目录。
I have solved the problem with these codes below ,我已经解决了下面这些代码的问题,
pathwd = "C:"+os.environ["HOMEPATH"]+"\\Desktop"
os.chdir(pathwd)
But now i have another problem :) .但现在我有另一个问题:)。 In my tkinter project it has some images.在我的 tkinter 项目中,它有一些图像。 But when i open a page on the exe file it says for example The system cannot find the path specified "abcdef.jpeg" how can i embed a picture in exe?但是当我在 exe 文件上打开一个页面时,它说例如系统找不到指定的路径“abcdef.jpeg”我如何在 exe 中嵌入图片?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.