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

2024-09-27 00:14:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图通过设置labelcolor参数来更改条形图图例中的字体颜色,看起来我需要Matplotlib 3.3或更高版本才能做到这一点(目前我在尝试时得到TypeError: __init__() got an unexpected keyword argument 'labelcolor')。我目前已经安装了3.2.2

我尝试在我的基本环境和自定义环境中运行conda install -c conda-forge matplotlib,它只是再次“更新”到3.2.2。我宁愿避免尝试pip安装,这样我就不会冒着把其他软件包搞砸的风险

提前谢谢


Tags: 版本an参数matplotlibinit颜色字体conda
1条回答
网友
1楼 · 发布于 2024-09-27 00:14:23

命令

conda install -c conda-forge matplotlib

翻译成祈使句

With the conda-forge channel prioritized, ensure that some version of the package matplotlib is installed in the current environment.

相反,根据OP的说法,我们需要命令式语句

Ensure that at least version 3.3 of the matplotlib package is installed in the current environment.

这转换为命令

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

这并不保证Conda可以满足此命令(例如,它可能与以前的规范冲突),只保证这是直译

信道规格

请注意,包括-c conda-forge将优先考虑该通道,但没有明确指定Conda必须使用该通道来源程序包。这是因为Conda还将考虑channel_priority配置值,并根据设置的是'strict'还是'flexible'而表现不同

然而,Conda的MatchSpec具有足够的表达能力,可以明确要求特定的包来自给定的通道。例如,要求至少从Conda Forge安装3.3版,将采取以下形式

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

相关问题 更多 >

    热门问题