带有 nidaqmx 的 Pyinstaller
我有一个用 python 编写的软件,我试图将其打包成可执行文件。其中一个模块有问题,我找不到任何相关信息:nidaqmx
运行标准 pyinstaller 后,例如。
pyinstaller myprogram.py
构建成功完成,但在警告文件中指出缺少 nidaqmx。然后,在运行可执行文件时,我得到以下信息:
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "nidaqmx\__init__.py", line 11, in <module>
File "importlib\metadata.py", line 530, in version
File "importlib\metadata.py", line 503, in distribution
File "importlib\metadata.py", line 177, in from_name
importlib.metadata.PackageNotFoundError: nidaqmx
我还注意到站点包中的 nidaqmx 文件夹尚未复制。我尝试过的事情:
- 添加“nidaqmx”作为隐藏导入(来自 .spec 文件或命令行)。添加与项目无关的其他模块似乎可以工作文件(意味着文件夹被复制)。
- 将钩子路径添加到 .spec 文件
不确定从这里去哪里。感谢您的任何建议。
I have a piece of software written in python that I am trying to package into an executable. One of the modules is being problematic and I can't find any information on it: nidaqmx
After running standard pyinstaller, eg.
pyinstaller myprogram.py
The build completes successfully but in the warnings file it notes that nidaqmx is missing. Then when running the executable, I get the following:
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "nidaqmx\__init__.py", line 11, in <module>
File "importlib\metadata.py", line 530, in version
File "importlib\metadata.py", line 503, in distribution
File "importlib\metadata.py", line 177, in from_name
importlib.metadata.PackageNotFoundError: nidaqmx
I also notice that the nidaqmx folder from the site-packages has not been copied. Things I have tried:
- add 'nidaqmx' as hidden import (both from .spec file or command line). Adding other modules unrelated to the project seems to work file (meaning the folder is copied over).
- add a hookpath to the .spec file
Not sure where to go from here. Thanks for any advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我解决了
nidaqmx/__init__.py
中的几行注释,并设法使可执行文件正确运行I resolved this commenting few lines in the
nidaqmx/__init__.py
and managed to have the executable running correctly如果您不想编辑
nidaqmx
的源代码,您可以将--copy-metadata
参数添加到 PyInstaller 命令中,如下所示:If you don't want to edit the source code of
nidaqmx
you can add the--copy-metadata
argument to the PyInstaller command like this: