英文:
Pyinstaller not including the FoxitSDK module when turning a .py to an executable
问题
我用Python制作了一个程序,可以在整个目录树中删除除第一页之外的所有PDF页面,并复制整个目录树。作为.py文件,一切都正常运行,但我希望将其转换为.exe文件,以便在没有Python或相关库的计算机上使用。当我运行pyinstaller.exe --onefile ./filename.py
时,它会生成一个.exe文件,但当我运行它时,会出现以下错误:
Traceback (most recent call last):
File "OnlyFirstPage.py", line 5, in <module>
from FoxitPDFSDKPython3 import *
File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
File "FoxitPDFSDKPython3\__init__.py", line 8, in <module>
ModuleNotFoundError: No module named 'fsdk'
我尝试添加--hidden-import=FoxitPDFSDKPython3
到命令中,但仍然遇到了相同的问题。
英文:
I made a program in python that removes all but the first page of a pdf in a whole directory tree and makes a copy of the tree, and it all works fine as a .py file, but I wanted to turn it into an .exe so that it can be used on a computer that doesn't have python or the libraries. When I run pyinstaller.exe --onefile ./filename.py
, it makes an exe but when I run it, it gives me this error:
Traceback (most recent call last):
File "OnlyFirstPage.py", line 5, in <module>
from FoxitPDFSDKPython3 import *
File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
File "FoxitPDFSDKPython3\__init__.py", line 8, in <module>
ModuleNotFoundError: No module named 'fsdk'
I tried adding --hidden-import=FoxitPDFSDKPython3 to the command, but got the same problem.
答案1
得分: 0
你是否有__init__.py
文件,该文件是否与./filename.py
在同一文件夹中?如果没有,请将它放在与./filename.py
相同的文件夹中。
如果这不起作用,请尝试这样!
pyinstaller.exe --onefile --paths=D:\env\Lib\site-packages(在此处放置Python包的路径) .\filename.py
英文:
Do you have __init__.py
file , is that file in same folder as ./filename.py
, if not . Put it in same folder as ./filename.py
.
if that didn't work , try this !
pyinstaller.exe --onefile --paths=D:\env\Lib\site-packages (put path to python packages here) .\filename.py
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论