PyInstaller 1.26.4 -- .exe 上的 Numpy 导入错误

问题描述 投票:0回答:1

尝试将 .py 文件转换为 .exe 时,转换按计划进行,但运行 .py 文件时出现以下错误:

`Traceback (most recent call last):  
  File <Filename>, line 17, in <module>  
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module  
  File "pandas\__init__.py", line 47, in <module>  
ImportError: Unable to import required dependencies:  
numpy: Error importing numpy: you should not try to import numpy from  
      its source directory; please exit the numpy source tree, and relaunch your python  
interpreter from there.  
[27328] Failed to execute script <Filename> due to unhandled exception!`

脚本本身使用 Pandas,所以我相信我需要 numpy 可用。

我将如何永久纠正 numpy 依赖项的这个问题?


我已经尝试了这两个软件包的多个版本,目前正在使用最新的版本。 我尝试过 --hidden-import numpy 没有成功或差异。

我尝试过查找类似的解决方案,但是当在 StackOverflow 上研究这个问题时,我发现最相关的答案是指由于 PyInstaller 和 Numpy 不能很好地配合而升级或降级软件包,但是这些帖子已经过时了好几年了,对我的情况没有帮助。

Numpy - 1.26.4 PyInstaller - 6.7.0

python-3.x numpy pyinstaller exe
1个回答
0
投票

降级 numpy 和 pandas 对我有用。 numpy==1.21.5 熊猫==1.4.2

© www.soinside.com 2019 - 2024. All rights reserved.