在python scrip中导入pandas库时,Power BI出错



以下是在python脚本中导入Power BI中的panda库时提到的错误。

Details: "ADO.NET: Python script error.
C:USERSYADAVPANACONDA3libsite-packagesnumpy__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:USERSYADAVPANACONDA3libsite-packagespandas__init__.py", line 17, in <module>
"Unable to import required dependencies:n" + "n".join(missing_dependencies)
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.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:USERSYADAVPANACONDA3python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues.  Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.

在Power BI中对此类错误进行排序的解决方案是什么?

忘记Anaconda并使用WinPython。我在StackOverflow和其他论坛上尝试了几天Anaconda的所有解决方案,但都没有成功。然后我尝试了WinPython,它立即起作用。当然,您需要相应地更改PowerBI选项。

  1. 要安装WinPython:https://github.com/winpython/winpython
  2. 要更改检测到的Python主目录:https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts#enable-python脚本

如果您考虑我的答案,您将不需要降级Python、PBI或其他任何东西。

我也有同样的错误。不幸的是,PowerBI无法与Jupyter Notebook Python配合使用。所以你必须安装一个";正常的";Python:https://www.python.org/downloads/

配置您想在PowerBI中使用的Python,并通过pip 安装您需要的Python库

编辑:请使用Python 3.8,因为3.9目前不支持NumPy

最新更新