0

我正在尝试使用 Anaconda2的Windrose Notebook Example中的简单 python windrose 示例。TypeError: unbound method __init__() must be called with Affine2DBase instance as first argument (got Affine2D instance instead)但是我在运行下面的简单代码时收到错误消息“ ”

from windrose import WindroseAxes
from matplotlib import pyplot as plt
import matplotlib.cm as cm
import numpy as np

ws = np.random.random(500) * 6
wd = np.random.random(500) * 360
ax = WindroseAxes.from_ax()

我很难理解我在网上找到的关于 affine2dbase 的信息,但我认为这可能是我的 matplotlib 安装的问题?这是我正在使用的版本

    matplotlib                2.2.3            py27h263d877_0
    matplotlib-base           2.2.5            py27h6595424_1    conda-forge
    windrose                  1.6.7                      py_1    conda-forge
    ipython                   5.8.0                    py27_0

这是以管理员身份安装 windrose 的 conda 安装信息:

(base) C:\WINDOWS\system32>conda install -c conda-forge windrose
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\Student\Anaconda2

  added / updated specs:
    - windrose


The following NEW packages will be INSTALLED:

  python_abi         conda-forge/win-64::python_abi-2.7-1_cp27m

The following packages will be UPDATED:

  conda                       pkgs/main::conda-4.8.3-py27_0 --> conda-forge::conda-4.8.3-py27h8c360ce_1


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

我将不胜感激有关如何修复 windrose 的输入,以便我可以运行基本示例或如何减轻 affine2d 错误。谢谢

4

1 回答 1

1

正如@fyberoptik 所建议的那样,解决方案是pip install windrose在 conda 提示符下使用。虽然在 anaconda 提示符中看起来没有任何变化,但 windrose 现在绘制测试数据和我自己的数据。

(base) C:\Users\Student>pip install windrose
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: windrose in c:\users\student\anaconda2\lib\site-packages (1.6.7)
    Requirement already satisfied: numpy in c:\users\student\anaconda2\lib\site-packages (from windrose) (1.16.5)
    Requirement already satisfied: matplotlib in c:\users\student\anaconda2\lib\site-packages (from windrose) (2.2.5)
    Requirement already satisfied: cycler>=0.10 in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (0.10.0)
    Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (2.4.2)
    Requirement already satisfied: python-dateutil>=2.1 in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (2.8.0)
    Requirement already satisfied: pytz in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (2019.3)
    Requirement already satisfied: six>=1.10 in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (1.12.0)
    Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (1.1.0)
    Requirement already satisfied: backports.functools_lru_cache in c:\users\student\anaconda2\lib\site-packages (from matplotlib->windrose) (1.5)
    Requirement already satisfied: setuptools in c:\users\student\anaconda2\lib\site-packages (from kiwisolver>=1.0.1->matplotlib->windrose) (41.4.0)

使用标准示例:

ws = np.random.random(500) * 6
wd = np.random.random(500) * 360
ax = WindroseAxes.from_ax()
ax.bar(wd, ws)

在此处输入图像描述

于 2020-04-29T13:00:47.820 回答