Matplotlib:Mpl_工具箱、AxesGrid、ImageGrid和Anaconda:如何获得这些函数?

2024-09-28 22:21:29 发布

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

我有一个装有matplotlib的anaconda3。在

唯一的问题是,mpl_toolkits不是可识别的包。一、 e.以下代码不起作用:

import mpl_toolkits

我在google上搜索过各种包/download/makefile/etc.安装mpl_toolkitsAxesGridmpl_toolkits.axes_grid1等的方式,尝试去做here。在

我跑过:

^{pr2}$

我去了水蟒垃圾箱,然后运行:

pip install ...
etc.

如何让这个包与python(特别是anaconda)一起工作?在


Tags: 代码importherematplotlibdownloadgoogle方式etc
3条回答

出了问题;库mpl_toolkits应该在Python环境中。在

bazooka-to-Kear-fight解决此问题的方法是转到github,创建用户名,在搜索栏中搜索“matplotlib”,从matplotlib项目下载matplotlib源代码zip文件…然后运行:

unzip matplotlib-master.zip
cd matplotlib-master
/your/path/to/anaconda3/bin/python3 setup.py install

然后,一切正常。令人惊叹的。在

bug report表明由于包的旧版本(特别是basemap),您的安装可能有问题。在

如果已安装git,则可以使用以下内容安装mpl_toolkits

git clone https://github.com/matplotlib/matplotlib
cd matplotlib
pip install -e . 

或者从here下载最新的zip文件,解压缩并在结果文件夹中使用相同的pip install -e .命令。在

使用这个:

conda activate # optional / use "source activate" in windows
conda install -c conda-forge basemap # use the -n flag for a particular environment

之后,您将获得以下文件夹:

^{pr2}$

相关问题 更多 >