为什么pip安装的matplotlib版本是0.91.1而PyPi显示的是1.0.0?

26 投票
4 回答
9576 浏览
提问于 2025-04-16 03:13

更新于2012年10月15日

现在PyPi上显示的matplotlib版本是1.1.0,所以这个问题已经解决了。你可以通过以下命令安装matplotlib:

pip install matplotlib

以下信息已过时

PyPi上显示的是matplotlib 1.0.0。但是,当我通过pip在一个虚拟环境中安装matplotlib时,安装的却是0.91.1版本。

  • 为什么版本会不一样?
  • 有没有办法通过pip安装matplotlib 1.0.0?

研究

看起来matplotlib在PyPi上的DOAP记录指向了正确的版本。下面是DOAP记录供参考:

<?xml version="1.0" encoding="UTF-8" ?>
<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><Project><name>matplotlib</name>
<shortdesc>Python plotting package</shortdesc>
<description>matplotlib strives to produce publication quality 2D graphics
      for interactive graphing, scientific publishing, user interface
      development and web application servers targeting multiple user
      interfaces and hardcopy output formats.  There is a 'pylab' mode
      which emulates matlab graphics</description>
<download-page>https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0</download-page>
<homepage rdf:resource="http://matplotlib.sourceforge.net" />
<maintainer><foaf:Person><foaf:name>John D. Hunter</foaf:name>
<foaf:mbox_sha1sum>4b099b4a7f50a1f39642ce59c2053c00d4de6416</foaf:mbox_sha1sum></foaf:Person></maintainer>
<release><Version><revision>1.0.0</revision></Version></release>
</Project></rdf:RDF>

配置

  • 操作系统:Mac OS X 10.6.6
  • Python 2.7
  • 虚拟环境版本:1.5.1
  • pip版本:0.8.1

更新于2010年8月24日 早上7:09

从PyPi镜像安装时也会安装0.91.1版本:

$ pip install -i http://d.pypi.python.org/simple matplotlib

更新于2011年1月14日 下午4:54

尽管matplotlib 1.0.1已经发布,但这个问题仍然存在。

4 个回答

8

我按照@oyvindio和@elaichi的建议去做,但不知道为什么我还是得到了版本0.91.1。这个版本在编译的时候出错了,错误信息是src/mplutils.cpp:17: error: ‘vsprintf’ was not declared in this scope

直接从git安装matplotlib对我来说是有效的:

pip install -e git+git@github.com:matplotlib/matplotlib.git#egg=matplotlib
11

这个问题发生是因为在PyPI上,matplotlib 1.0的下载链接指向了一个pip看起来不是文件的地址(这个地址以/download结尾,而不是一个具体的文件名)。你可以查看这个关于pip的错误报告

目前,我知道的最好的解决办法是oyvindio提供的这个方法,直到pip对链接的处理变得更灵活,或者matplotlib修复他们在PyPI上的链接。

18

我也遇到过同样的问题。我不知道为什么会这样,但我有一个解决办法;在使用pip时加上-f选项,这样可以告诉它去哪里找matplotlib的源文件。(这个方法在requirements.txt文件中也适用)。

pip install -f http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0/matplotlib-1.0.0.tar.gz matplotlib

撰写回答