简体   繁体   English

如何让 matplotlib 实际更新到最新版本?

[英]How do I get matplotlib to actually update to the latest version?

I'm trying to change the font color in the legend of a barplot by setting the labelcolor parameter, and it looks like I'll need Matplotlib 3.3 or later to do so (currently I'm getting TypeError: __init__() got an unexpected keyword argument 'labelcolor' when I try).我正在尝试通过设置labelcolor参数来更改条形图图例中的字体颜色,看起来我需要 Matplotlib 3.3 或更高版本才能这样做(目前我收到TypeError: __init__() got an unexpected keyword argument 'labelcolor'我尝试时TypeError: __init__() got an unexpected keyword argument 'labelcolor' )。 I currently have 3.2.2 installed.我目前安装了 3.2.2。

I tried running conda install -c conda-forge matplotlib in both my base environment and a custom environment, and it just "updated" to 3.2.2 again.我尝试在我的基本环境和自定义环境中运行conda install -c conda-forge matplotlib ,它再次“更新”到 3.2.2。 I'd prefer to avoid trying a pip install so I don't risk screwing up other packages.我宁愿避免尝试安装 pip,这样我就不会冒险搞砸其他软件包。

Thanks in advance.提前致谢。

The command命令

conda install -c conda-forge matplotlib

translates to the imperative转化为命令式

With the conda-forge channel prioritized, ensure that some version of the package matplotlib is installed in the current environment.在 conda - forge 通道优先的情况下,确保在当前环境中安装了 package matplotlib的某些版本。

In contrast, according to OP, we want the imperative statement相反,根据 OP,我们想要命令式语句

Ensure that at least version 3.3 of the matplotlib package is installed in the current environment.确保在当前环境中至少安装了matplotlib package 版本 3.3。

which translates to the command转换为命令

conda install matplotlib[version='>=3.3']

This does not guarantee that Conda can satisfy this command (eg, it could conflict with previous specifications), only that this is the literal translation.这并不能保证 Conda 可以满足这个命令(例如,它可能与以前的规范冲突),只是这是字面意思的翻译。

Channel Specification通道规格

Note that including -c conda-forge will prioritize that channel, but does not explicit specify that Conda must use that channel to source the package.请注意,包括-c conda-forge将优先考虑该通道,但未明确指定 Conda 必须使用该通道来获取 package。 This is because Conda will also take into account the channel_priority configuration value, and will behave differently depending on whether 'strict' or 'flexible' is set.这是因为 Conda 还将考虑channel_priority配置值,并且会根据设置为'strict'还是'flexible'而表现不同。

However, Conda's MatchSpec is sufficiently expressive to explicitly demand a particular package is sourced from a given channel.但是,Conda 的 MatchSpec 具有足够的表现力,可以明确要求特定的 package 来自给定的通道。 For example, to demand that at least version 3.3 is installed from Conda Forge, would take the form例如,要求至少从 Conda Forge 安装 3.3 版,将采用以下形式

conda install conda-forge::matplotlib[version='>=3.3']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM