python-3.x - 在使用 Astroquery 的 python 脚本上使用 PyInstaller 编译 exe 文件时出现 FileNotFoundError
问题描述
我正在尝试编译我为研究编写的 python 脚本的 exe,以便我可以与没有安装 python 的实验室合作伙伴共享它。
要创建可执行文件,我只是pyinstaller opposition_calc.py
在 anaconda 提示符中输入(opposition_calc.py 是我的 python 脚本)。
编译过程似乎工作正常,但是,当从命令行执行 exe 时,将为 astroquery 模块报告 FileNotFoundError。
Traceback (most recent call last):
File "opposition_calc.py", line 2, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 540, in exec_module
File "astroquery\__init__.py", line 29, in <module>
File "astroquery\__init__.py", line 22, in _get_bibtex
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\jusge\\OneDrive\\Desktop\\distribution_calc\\opposition_calculator\\opposition_calc\\dist\\opposition_calc\\astroquery\\CITATION'
[1172] Failed to execute script opposition_calc
据我所知,它正在寻找一个名为“astroquery”的目录并且找不到它。但是,分发文件夹中没有标题为“astroquery”的目录,因此很明显在编译过程中没有包含它。我对 python 或 pyinstaller 不是很熟悉,所以我不太确定如何确保它被包含在内。
解决方案
推荐阅读
- javascript - 动画迭代的延迟
- elasticsearch - 弹性搜索查询其中值存在于 2 个字段值之间
- ios - ios如何使用地理围栏监视多边形或矩形区域的进入或退出
- ruby-on-rails - Ruby - 需要向按钮添加功能的能力
- node.js - 导入函数的参数 - 所以回调 - req.body.value 未定义
- debugging - 在 emacs 中使用 gud 提示缺少正在运行的 delve?
- c# - .submit() 阻止表单提交
- instrumentation - 如何使用 dexlib2 检测某些方法,尤其是分配寄存器以添加新指令?
- java - 使用 Morphia 返回匹配的数组元素
- python - 张量流模型保存和恢复问题