[英]pip displays incorrect version of package
I am not sure if this is a bug, or if I am doing something wrong. 我不确定这是否是错误,或者我做错了什么。 The situation is the following,
情况如下,
pip list -o
yields a list of outdated python packages along with what is suppose to be the current installed version. 产生一个过时的python软件包列表,以及假定是当前已安装的版本。 The issue is that I am pretty sure that it is giving me the wrong information on at least some packages as I can verify, as in the example below, that the version of ipython that pip thinks is installed (2.0.0) is not the one that I get when I run ipython from the command prompt (version==2.1.0).
问题是,我可以确定,至少可以确定我给某些软件包提供了错误信息,如下例所示,pip认为已安装的ipython版本(2.0.0)并非正确。当我从命令提示符(版本== 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.
My question is: Is there a way to have pip understand the correct version of the installed python packages? 我的问题是:有没有办法让pip理解已安装的python软件包的正确版本?
You can run the following commands to see where the package is from: 您可以运行以下命令来查看软件包的来源:
which ipython
and: 和:
pip show ipython
You may have two installations: one that was installed with pip install ipython
and an installation via a separate tool (package manager on Linux or Ports/brew on Mac). 您可能有两种安装方式:一种是通过
pip install ipython
安装的,另一种是通过单独的工具(Linux上的程序包管理器或Mac上的Ports / brew)安装的。
So the way to do this properly is a little bit more involved than what I anticipated, but I have to submit it as the proper answer as it actually resolves the issue. 因此,正确执行此操作的方法比我预期的要复杂一些,但是我必须提交它作为正确的答案,因为它实际上可以解决问题。
Suppose the package version that is misunderstood by pip
is pandas
. 假设被
pip
误解的软件包版本是pandas
。 So that the behavior you observe is that: 这样您观察到的行为是:
pip list --outdated
says that the version of pandas
you have installed is 0.14.0
; 说您已安装的
pandas
版本是0.14.0
; but when you inquire about the version of pandas
in say ipython
: 但是当您询问说
ipython
的pandas
版本时:
In [1]: import pandas
In [2]: pandas.__version__
Out[2]: '0.14.1'
In order to resolve this: 为了解决这个问题:
pip show pandas
; pip show pandas
; it should tell you about the location of the distribution, in my case /usr/local/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages
cd /usr/local/lib/python2.7/dist-packages
cd /usr/local/lib/python2.7/dist-packages
ls -lstrh pandas-0.14.*
; ls -lstrh pandas-0.14.*
; you should see files associated with both your 0.14.1
version and the 0.14.0
one you want to get rid of 0.14.1
版本与0.14.0
你想摆脱一个 rm -rf pandas-0.14.0*.egg-info pandas-0.14.0*.pth
rm -rf pandas-0.14.0*.egg-info pandas-0.14.0*.pth
That should be it! 就是这样!
pip show pandas
should now agree with what pandas.__version__
现在应该同意什么
pandas.__version__
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.