3

我开发了一个 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

有任何想法吗?谢谢!

4

0 回答 0