2014-06-22 134 views
1

我不確定這是一個錯誤還是我做錯了什麼。 的情況下面,pip顯示軟件包的不正確版本

pip list -o 

產生什麼是假設是當前安裝的版本一起過時的Python包的列表。 問題是,我很確定它至少給我一些錯誤的信息,至少在某些包上,因爲我可以驗證,如下例所示,pip認爲已安裝(2.0.0)的ipython版本不是我從命令提示符(版本== 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軟件包的正確版本?和

which ipython 

回答

0

所以正確做到這一點的方式比我預期的要多一點,但我必須提交它作爲正確答案,因爲它實際上可以解決問題。

假設被pip誤解的包版本是pandas。所以,你觀察到的行爲是:

pip list --outdated 

說,你已經安裝pandas版本是0.14.0;但是當你詢問中說ipython版本的pandas

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版本和您想擺脫
  4. 運行rm -rf pandas-0.14.0*.egg-info pandas-0.14.0*.pth

這應該是它的0.14.0一個相關的文件!

pip show pandas 

現在應該同意什麼pandas.__version__

2

您可以運行下面的命令,看看那裏的包是從

pip show ipython 

您可能有兩個安裝:這是安裝了pip install ipython之一,並通過安裝一個單獨的工具(Linux上的軟件包管理器或Mac上的Ports/brew)。

+0

我取出資質安裝的版本。 – tipanverella

+0

超級怪異: kolmogorov:〜#pip show ipython --- 名稱:ipython 版本:2.0。0 位置:/usr/local/lib/python2.7/dist-packages 需要: kolmogorov:〜#pip卸載ipython 無法卸載'ipython'。沒有發現任何文件卸載。 – tipanverella

+0

pip無法卸載所有軟件包:http://pip.readthedocs.org/en/latest/reference/pip_uninstall.html。也可能是元數據文件丟失。 –