当PyPi显示版本1.0.0时,为什么pip安装matplotlib版本0.91.1?

时间:2010-08-24 10:38:49

标签: python matplotlib pip pypi

2012年10月15日更新

PyPi现在在1.1.0显示matplotlib,所以这个问题已经解决了。通过以下方式安装matplotlib:

pip install matplotlib

以下的过时信息

PyPi显示matplotlib 1.0.0。但是,当我通过pip将matplotlib安装到virtualenv时,安装了版本0.91.1。

  • 为什么版本有差异?
  • 有没有办法pip install matplotlib 1.0.0?

研究

matplotlib's DOAP record on PyPi似乎指向正确的版本。以下是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
  • virtualenv 1.5.1
  • pip 0.8.1

更新24-Aug-10 7:09 AM

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

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

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

即使已发布matplotlib 1.0.1,此问题仍然存在。

4 个答案:

答案 0 :(得分: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

答案 1 :(得分:11)

这是因为PyPI上的matplotlib 1.0的下载链接指向一个URL,该URL似乎不是一个已知格式的文件(URL以/ download而不是文件名结尾)。请参阅此bug filed on pip

oyvindio的解决方法是我现在所知道的最佳选择,直到pip对URL更加灵活或者matplotlib修复了他们的PyPI链接。

答案 2 :(得分: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

答案 3 :(得分:3)

Oyvindio的建议很棒,但首先我必须安装源代码编译matplotlib所需的一些头文件(否则它拒绝工作)。在Ubuntu Lucid中,它是这样的:

$ sudo apt-get build-dep python-matplotlib

就在那时,可以pip install matplotlib:

pip install -f  http://garr.dl.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz  matplotlib