运行 pyinstaller 可执行文件时出现 FileNotFoundError [Errno 2]? [英] FileNotFoundError [Errno 2] when running pyinstaller executable?
问题描述
我正在尝试使用 Pyinstaller 将我的 python 文件制作为可执行文件.转换过程完成后,在我的 dist 文件夹中,当我单击myApplication.exe"时,出现以下错误:FileNotFoundError: [Errno 2] 没有这样的文件或目录:'C:\\Users\\user\\Desktop\\Application\\dist\\myApplication\\smart_open\\VERSION'[17416] 无法执行脚本 myApplication
I am trying to make my python file as an executable using Pyinstaller. After the process of conversion has finished, in my dist folder, when I click on "myApplication.exe" I get the following error:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\user\\Desktop\\Application\\dist\\myApplication\\smart_open\\VERSION'
[17416] Failed to execute script myApplication
我已经搜索过这个问题的答案,但没有一个有我的特定错误,即文件夹 smart_open\VERSION
因为我不知道那应该是什么.
I've already searched for answers to this but none of them have the specific error as mine which is the folder smart_open\VERSION
as I have no idea what that's supposed to be.
编辑
smart_open
文件夹甚至不存在于我的 myApplication
文件夹中
The smart_open
folder does not even exists in my myApplication
folder
推荐答案
我觉得你必须在 spec
中加入 smart_open
的 VERSION
文件代码>文件.文档中的更多信息.
I think you have to add the VERSION
file of smart_open
in the spec
file. More information in the documentation.
编辑
在这种情况下,datas
行应该是:
In this case, datas
line should be:
datas=[ ('c:\\python360564\\lib\\site-packages\\smart_open\\VERSION', 'smart_open\\VERSION' )],
第一部分是文件的初始路径,第二部分是目标路径(从错误消息中获取).
The first part is the initial path of the file and the second the destination path (get from the error message).
这篇关于运行 pyinstaller 可执行文件时出现 FileNotFoundError [Errno 2]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!