简体   繁体   English

PyInstaller - FileNotFoundError: [Errno 2] 没有这样的文件或目录

[英]PyInstaller - FileNotFoundError: [Errno 2] No such file or directory

I'm not too familiar with using PyInstaller but I have been trying to use it to convert my.py files to a single exe.我对使用 PyInstaller 不太熟悉,但我一直在尝试使用它将 my.py 文件转换为单个 exe。 I am using Windows 10 with Python 3.10.5 and PyInstaller 5.2.我正在使用 Windows 10 和 Python 3.10.5 和 PyInstaller 5.2。 My files look like the following:我的文件如下所示:

Scripts Folder

       -venv Folder

       -Dependent Files Folder

       -main.py

       -1.py

       -2.py

       -3.py 

       -4.py

I am able to create an exe using 'pyinstaller --onefile -w main.py' in the console and move it from dist to the main Scripts folder.我可以在控制台中使用“pyinstaller --onefile -w main.py”创建一个 exe,并将其从 dist 移动到主 Scripts 文件夹。 Once I launch the exe I get the error FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Jack\AppData\Local\Temp\_MEIXXXXX\palettable\colorbrewer\data\colorbrewer_all_schemes.json'.启动 exe 后,我收到错误 FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Jack\AppData\Local\Temp\_MEIXXXXX\palettable\colorbrewer\data\colorbrewer_all_schemes.json'。 I've also tried using auto-py-to-exe and get the same issue.我也尝试过使用 auto-py-to-exe 并遇到同样的问题。

When I check that directory I don't see a folder 'palettable' in the _MEIXXXXX folder (hence the error), but I'm not sure how to add it to that directory.当我检查该目录时,我在 _MEIXXXXX 文件夹中看不到“palettable”文件夹(因此出现错误),但我不确定如何将其添加到该目录。 I do see 'colorbrewer_all_schemes.json' in the venv folder within the same _MEIXXXXX folder but the exe can't find it there.我确实在同一个 _MEIXXXXX 文件夹内的 venv 文件夹中看到了“colorbrewer_all_schemes.json”,但 exe 在那里找不到它。 I can't add it manually cause it is a temp folder and a new _MEIXXXXX folder will be generated each time I launch the exe again.我无法手动添加它,因为它是一个临时文件夹,每次我再次启动 exe 时都会生成一个新的 _MEIXXXXX 文件夹。 I've also made sure the library 'palettable' is installed in the virtual environment and in console.我还确保在虚拟环境和控制台中安装了库“palettable”。

As I say I'm not too familiar with converting.py files to.exe so any help is appreciated.正如我所说,我对将 .py 文件转换为 .exe 不太熟悉,因此不胜感激。 Let me know if you need more information.如果您需要更多信息,请与我们联系。

I found an answer to my own question.我找到了自己问题的答案。 I still don't know why it couldn't find the palettable library but I was able to get it working by putting this in the command window:我仍然不知道为什么它找不到可调色板库,但我可以通过将其放入命令 window 来使其工作:

pyinstaller --collect-data palettable --onefile main.py pyinstaller --collect-data 调色板 --onefile main.py

This allowed it to I guess collect it manually though I'm still not sure how it wasn't able to find palettable in the first place since its installed the same way as all the other dependent libraries.这让我猜它可以手动收集它,尽管我仍然不确定它是如何无法找到可放置的,因为它的安装方式与所有其他依赖库相同。 Hopefully this helps anyone with a similar issue.希望这可以帮助任何有类似问题的人。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PyInstaller + UI 文件 - FileNotFoundError: [Errno 2] 没有这样的文件或目录: - PyInstaller + UI Files - FileNotFoundError: [Errno 2] No such file or directory: Pyinstaller & Matplotlib。 如何解决: FileNotFoundError: [Errno 2] No such file or directory:..? - Pyinstaller & Matplotlib. How to solve: FileNotFoundError: [Errno 2] No such file or directory:..? PyInstaller 错误:FileNotFoundError:[Errno 2] 没有这样的文件 ot 目录:'myKivyfile.kv' - PyInstaller Error: FileNotFoundError: [Errno 2] No such file ot directory: 'myKivyfile.kv' Pyinstaller "FileNotFoundError: [Errno 2] No such file or directory:" 运行应用程序时 - Pyinstaller "FileNotFoundError: [Errno 2] No such file or directory:" when running app Pyinstaller错误捆绑蛋文件FileNotFoundError:[Errno 2]没有这样的文件或目录 - Pyinstaller Error Bundling Egg Files FileNotFoundError: [Errno 2] No such file or directory 为什么我收到 Pyinstaller FileNotFoundError: [Errno 2] No such file or directory: - Why am I getting Pyinstaller FileNotFoundError: [Errno 2] No such file or directory: PyInstaller - FileNotFoundError:没有这样的文件或目录:'' - PyInstaller - FileNotFoundError: No such file or directory: '' FileNotFoundError:[Errno 2]没有这样的文件或目录: - FileNotFoundError: [Errno 2] No such file or directory: FileNotFoundError [Errno 2] 没有这样的文件或目录: - FileNotFoundError [Errno 2] No such file or directory: FileNotFoundError: [Errno 2] 没有这样的文件或目录? - FileNotFoundError: [Errno 2] No such file or directory?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM