pip显示不正确的包版本

时间:2014-06-22 02:18:41

标签: python pip

我不确定这是一个错误,还是我做错了什么。 情况如下,

pip list -o 

产生一个过时的python包列表以及假设当前安装的版本。 问题是我很确定它至少在某些软件包上给出了错误信息,因为我可以验证,如下例所示,pip认为安装的ipython版本(2.0.0)不是我从命令提示符(version == 2.1.0)运行ipython时获得的一个。

kolmogorov:~# pip list -o | head -15
Warning: cannot find svn location for PEAK-Rules==0.5a1.dev-r2707
Warning: cannot find svn location for prioritized-methods==0.2.2dev-20110830
scipy (Current: 0.13.2 Latest: 0.14.0)
plotly (Current: 1.0.30 Latest: 1.0.32)
SOAPpy (Current: 0.12.21 Latest: 0.12.22)
openpyxl (Current: 1.8.6 Latest: 2.0.3)
networkx (Current: 1.8.1 Latest: 1.9)
setuptools (Current: 3.4.1 Latest: 5.1)
brewer2mpl (Current: 1.3.2 Latest: 1.4)
repoze.who (Current: 1.0.19 Latest: 2.2)
pandas (Current: 0.13.1 Latest: 0.14.0)
pygeocoder (Current: 1.2.2 Latest: 1.2.5)
ipython (Current: 2.0.0 Latest: 2.1.0)
tornado (Current: 3.2 Latest: 3.2.2)
Could not find any downloads that satisfy the requirement vboxapi
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 156, in main
    logger.fatal('Exception:\n%s' % format_exc())
  File "/usr/lib/python2.7/dist-packages/pip/log.py", line 111, in fatal
    self.log(self.FATAL, msg, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/pip/log.py", line 164, in log
    consumer.flush()
IOError: [Errno 32] Broken pipe


kolmogorov:~# ipython
Python 2.7.7 (default, Jun  3 2014, 16:16:56) 
Type "copyright", "credits" or "license" for more information.

IPython 2.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

我的问题是:有没有办法让pip了解已安装的python包的正确版本?

2 个答案:

答案 0 :(得分:2)

您可以运行以下命令以查看程序包的来源:

which ipython

pip show ipython

您可能有两个安装:一个安装了pip install ipython,一个安装通过一个单独的工具(Linux上的软件包管理器或Mac上的Ports / brew)。

答案 1 :(得分:0)

所以正确地做到这一点的方式比我预期的要多一些,但我必须将其作为正确答案提交,因为它实际上解决了这个问题。

假设pip误解的包版本为pandas。所以你观察到的行为是:

pip list --outdated

表示您安装的pandas版本为0.14.0;但是,当您在pandas中查询ipython的版本时:

In [1]: import pandas 

In [2]: pandas.__version__
Out[2]: '0.14.1'

为了解决这个问题:

  1. 运行pip show pandas;它应告诉您分发的位置,在我的情况下/usr/local/lib/python2.7/dist-packages
  2. 重定向到该位置cd /usr/local/lib/python2.7/dist-packages
  3. 运行ls -lstrh pandas-0.14.*;你应该看到与你想要摆脱的0.14.1版本和0.14.0版本相关联的文件
  4. 运行rm -rf pandas-0.14.0*.egg-info pandas-0.14.0*.pth
  5. 那应该是它!

    pip show pandas 
    

    现在应该同意pandas.__version__