创建 .exe 文件后没有这样的文件或目录 - Python

No such file or directory after creating a .exe file - Python

我制作了一个脚本,可以在用户的​​ Facebook 个人资料中创建一个新的 post。在使用 py2exe 之前它工作正常,但在创建 .exe 文件之后它一直给我同样的错误。

代码:

import facebook, time

try:
    token = input("Your Token: ")
    text = input("The new post: ")
    graph = facebook.GraphAPI(token)
    fb_response = graph.put_wall_post(text)

except Exception as e:
    print(e)
    time.sleep(50)

错误:

[Errno 2] No such file or directory

注意:.pyc(Python 编译文件)工作正常,没有任何错误。只有 .exe 文件给出错误。

问题已解决。我刚刚使用了 PyInstaller,它工作正常。无论如何谢谢