Python 在 PowerBI 中编写脚本

Python scripting inside PowerBI

我正在将此处的一个简单示例复制到 运行 Python 到 Power BI 桌面:

https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts

import pandas as pd 
data = [['Alex',10],['Bob',12],['Clarke',13]] 
df = pd.DataFrame(data,columns=['Name','Age'],dtype=float) 
print (df)

我不知道从哪里开始解决这个错误:

Details: "ADO.NET: Python script error.
<pi>Traceback (most recent call last):
  File "PythonScriptWrapper.PY", line 2, in <module>
    import os, pandas, matplotlib
  File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py", line 174, in <module>
    _check_versions()
  File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py", line 159, in _check_versions
    from . import ft2font
ImportError: DLL load failed while importing ft2font: The specified module could not be found.
</pi>"

这个有效:

pip uninstall matplotlib
pip install --upgrade matplotlib

pip uninstall pandas
pip install --upgrade pandas

pip uninstall pillow
pip install --upgrade pillow