0

我目前在我的机器上安装了 anaconda。我编写了一个 Python 脚本,它在 Jupyter Notebook 中运行良好,下一步是我想在 Power BI 中执行这个脚本来导入数据并预处理数据。

我已经调整了 powerBI 中的设置(我认为是正确的):

  • Python 目录设置为C:\ProgramData\Anaconda3
  • 检测到的 Python IDE 设置为 .PY 文件的默认操作系统程序

您能否为以下错误提供解决方案。我花了几个小时试图找到一些东西。

错误

Details: "ADO.NET: Python script error.
<pi>C:\PROGRAMDATA\ANACONDA3\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
  from . import _distributor_init
Traceback (most recent call last):
  File "PythonScriptWrapper.PY", line 2, in <module>
    import os, pandas, matplotlib
  File "C:\PROGRAMDATA\ANACONDA3\lib\site-packages\pandas\__init__.py", line 16, in <module>
    raise ImportError(
ImportError: Unable to import required dependencies:
numpy: 

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 "C:\PROGRAMDATA\ANACONDA3\python.exe"
  * The NumPy version is: "1.18.5"

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

Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.

</pi>"
4

1 回答 1

0

如果需要在 Power BI 中运行 Python 脚本并安装 Anaconda 堆栈,则必须先激活它,然后才能使用它。只需打开 Anaconda Prompt 或conda activate在 cmd 提示符下运行。然后从激活的环境中启动 PBIDesktop,例如:

(base) C:\> "Program Files\Microsoft Power BI Desktop\bin\PBIDesktop.exe"

确保 Python 主目录 (Anaconda3) 也已添加到 Python 脚本部分的 PBIDesktop 全局选项中。

于 2021-09-01T19:55:25.483 回答