微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将 Nuitka 用于使用 Numpy、Pandas 和 Plotly 的 Python 应用程序时出错

如何解决将 Nuitka 用于使用 Numpy、Pandas 和 Plotly 的 Python 应用程序时出错

我开发了一个 PyQT5 应用程序,它也使用 Numpy、Pandas 和 Plotly。为了将其打包,我决定使用 Nuitka,但是由于该产品面向不熟悉 Python 的最终用户,我想确保将解释器与应用程序打包为单个二进制文件(类似于 PyInstaller) .

我正在运行以下命令,但出现错误,我正在努力找出如何修复:

$ python -m nuitka --standalone --show-progress --recurse-all --plugin-enable=numpy main.py

我正在使用 PyCharm,所有库都在项目目录的虚拟环境中。我使用的 Python 版本是 3.9。

在 Windows 中生成一个可执行的二进制文件,但是在运行时我收到以下错误消息:

C:\Users\user\PycharmProjects\PlotlyExample\main.dist>main
Traceback (most recent call last):
  File "C:\Users\user\PYCHAR~1\PLOTLY~1\MAIN~1.dis\numpy\core\__init__.py",line 22,in <module numpy.core>
  File "C:\Users\user\PYCHAR~1\PLOTLY~1\MAIN~1.dis\numpy\core\multiarray.py",line 12,in <module numpy.core.multiarray>
  File "C:\Users\user\PYCHAR~1\PLOTLY~1\MAIN~1.dis\numpy\core\overrides.py",line 7,in <module numpy.core.overrides>
ImportError: LoadLibraryExW 'C:\Users\user\PYCHAR~1\PLOTLY~1\MAIN~1.dis\numpy\core\_multiarray_umath.pyd' Failed: The specified module Could not be found.

During handling of the above exception,another exception occurred:

Traceback (most recent call last):
  File "C:\Users\user\PYCHAR~1\PLOTLY~1\MAIN~1.dis\main.py",line 5,in <module>
  File "C:\Users\user\PYCHAR~1\PLOTLY~1\MAIN~1.dis\numpy\__init__.py",line 140,in <module numpy>
  File "C:\Users\user\PYCHAR~1\PLOTLY~1\MAIN~1.dis\numpy\core\__init__.py",line 48,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.9 from "C:\Users\user\PYCHAR~1\PLOTLY~1\MAIN~1.dis\python.exe"
  * The NumPy version is: "1.19.3"

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

Original error was: LoadLibraryExW 'C:\Users\\user\PYCHAR~1\PLOTLY~1\MAIN~1.dis\numpy\core\_multiarray_umath.pyd' Failed: The specified module Could not be found.

示例代码 https://pastebin.com/RjRYUk0C

有什么想法吗?谢谢!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。