栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

关于nuitka打包的numpy奇怪报错

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

关于nuitka打包的numpy奇怪报错

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

Traceback (most recent call last):
  File "E:FinalPicdistnumpycore__init__.py", line 23, in 
  File "E:FinalPicdistnumpycoremultiarray.py", line 10, in 
  File "E:FinalPicdistnumpycoreoverrides.py", line 6, in 
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:FinalPicdistFinalPic.py", line 6, in 
  File "E:FinalPicdistnumpy__init__.py", line 144, in 
  File "E:FinalPicdistnumpycore__init__.py", line 49, in 
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:FinalPicuititle.ico --remove-output --output-dir=dist FinalPic.py

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

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/829421.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号