关于nuitka打包的numpy奇怪报错

关于nuitka打包的numpy奇怪报错,第1张

现在大多用pyinstaller打包,但仍有时候要用到nuitka,这次用nuitka打包后在命令行窗口运行exe文件出现了如下问题:
一开始以为是numpy或者Python两个版本不匹配,看到网上有的说把numpy版本降低到1.16.几才行,有的说最好不要用–plugin-enable=numpy而是最后去anoconda或python下复制包,于是把各版本numpy都试了一遍,还是numpy报错。

Traceback (most recent call last):
  File "E:\FinalPic\dist\numpy\core\__init__.py", line 23, in <module numpy.core>
  File "E:\FinalPic\dist\numpy\core\multiarray.py", line 10, in <module numpy.core.multiarray>
  File "E:\FinalPic\dist\numpy\core\overrides.py", line 6, in <module numpy.core.overrides>
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\FinalPic\dist\FinalPic.py", line 6, in <module>
  File "E:\FinalPic\dist\numpy\__init__.py", line 144, in <module numpy>
  File "E:\FinalPic\dist\numpy\core\__init__.py", line 49, in <module numpy.core>
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.8 from "FinalPic.exe"
  * The NumPy version is: "1.22.3"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was:


后来把numpy换成最新版,用nuitka显示所有详细打包信息,发现并没有错误出现该有的包都已经打包完成,最后用以下代码打包成功(没错,还是直接用nuitka打包了最新版numpy和其他依赖成功的)

nuitka --mingw64 --standalone --windows-disable-console --plugin-enable=qt-plugins --plugin-enable=pyqt5,numpy --windows-icon-from-ico=E:\FinalPic\ui\title.ico --remove-output --output-dir=dist FinalPic.py

打包完把外部依赖放入目录下,去命令行窗口执行exe,成功。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/722735.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-26
下一篇 2022-04-26

发表评论

登录后才能评论

评论列表(0条)

保存