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

2024-05-16 11:53:59 发布

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

2012年10月15日更新

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

pip install matplotlib

下面是过时的信息

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

  • 为什么版本不同?
  • 有没有办法pip安装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
  • Python2.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已经发布,这个问题仍然存在。


Tags: installpipnameorg版本pypicomhttp
3条回答

我也经历过同样的问题。我不知道为什么会发生这种情况,但我有一个解决方案;使用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

我听从了@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

发生这种情况的原因是,PyPI上matplotlib 1.0的下载链接指向的URL似乎不是已知格式的文件(URL以/download结尾,而不是文件名)。看这个bug filed on pip

oyvindio的解决方案是目前我所知道的最好的选择,直到pip在URL上变得更灵活,或者matplotlib修复了它们的PyPI链接。

相关问题 更多 >