Tell existing shell about upgraded pip
When using pip to upgrade itself on a system which already has it
installed, the existing shell does not quite know about the new version.
Even though the 'which' command knows about the new package, running
'pip' will actually execute the previous version.
This means any scripts which require a new version of pip will not work
as expected. This is related to 07123ebeaa
"Fix wrong version of pip
used in bootstrap" where the wrong version of pip was being used
(although it was fixed in a different manner there due to the use of
virtualenv).
Note that this does not affect systems which do not already have pip
installed, nor instances which run a new shell after upgrading pip.
This can be seen if one uses apt-get to install pip on Ubuntu 14.04 and
then uses pip to upgrade itself. For example:
root@ubuntu:~# apt-get install python-pip
root@ubuntu:~# which pip
/usr/bin/pip
root@ubuntu:~# pip --version
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
root@ubuntu:~# pip install --upgrade pip
root@ubuntu:~# which pip
/usr/local/bin/pip
root@ubuntu:~# pip --version
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
root@ubuntu:~# hash -r pip
root@ubuntu:~# pip --version
pip 8.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)
This patch forces the shell to re-hash the location of pip after an
upgrade.
Change-Id: Ifd9182ec862d6f8e9de2f0e4dc7778fbd46bb594
This commit is contained in:
parent
c7bdf68c4f
commit
92ad6107e1
@ -217,6 +217,9 @@ function get_pip {
|
||||
# been updated at this point to include any newer pip packages.
|
||||
pip install --upgrade ${PIP_INSTALL_OPTIONS} || pip install --upgrade --isolated ${PIP_INSTALL_OPTIONS}
|
||||
|
||||
# Ensure that our shell knows about the new pip
|
||||
hash -r pip
|
||||
|
||||
# when pip is not installed, install it
|
||||
else
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user