简体   繁体   中英

pip does not upgrade packages

I have the following version of numpy installed:

sh-3.2# pip --version
pip 1.5.4 from /usr/local/lib/python2.7/site-packages (python 2.7)

sh-3.2# pip list
...
numpy (1.7.1)
...

sh-3.2# pip install --upgrade --ignore-installed numpy
Downloading/unpacking numpy
  Downloading numpy-1.8.0.tar.gz (3.8MB): 3.8MB downloaded
  Running setup.py (path:/private/tmp/pip_build_root/numpy/setup.py) egg_info for package numpy
    Running from numpy source directory.

...installing stuff..

Successfully installed numpy
Cleaning up...
sh-3.2# pip list
...
numpy (1.7.1)
...

As you can see: Nothing is upgraded. How is that?

Update: Complete output of the installation process: http://pastebin.com/wki2JNyh

Update2: Actually I think the paths should be okay:

sh-3.2# which pip
/usr/local/bin/pip
sh-3.2# ls -l /usr/local/bin/pip
lrwxr-xr-x  1 Tom  admin  30 15 Jun  2013 /usr/local/bin/pip -> ../Cellar/python/2.7.5/bin/pip
sh-3.2# which python
/usr/local/bin/python
sh-3.2# ls -l /usr/local/bin/python
lrwxr-xr-x  1 Tom  admin  33 15 Jun  2013 /usr/local/bin/python -> ../Cellar/python/2.7.5/bin/python
sh-3.2# pip --version
pip 1.5.4 from /usr/local/lib/python2.7/site-packages (python 2.7)

The directory /usr/local/lib/python2.7/site-packages contains the following stuff:

Ghost.py-0.1b3-py2.7.egg-info                       patsy-0.2.1-py2.7.egg-info                          setuptools.pth
IPython                                             pip                                                 sip.so
PyQt4                                               pip-1.5.4-py2.7.egg-info                            sipconfig.py
astroid                                             pylab.pyc                                           sipconfig.pyc
astroid-1.0.0-py2.7.egg-info                        pylint                                              sipdistutils.py
backports                                           pylint-1.0.0-py2.7.egg-info                         site.py
backports.ssl_match_hostname-3.4.0.2-py2.7.egg-info pyparsing-2.0.1-py2.7.egg-info                      site.pyc
dateutil                                            pyparsing.py                                        sitecustomize.py
distribute-0.6.45-py2.7.egg                         pyparsing.pyc                                       sitecustomize.pyc
easy-install.pth                                    python_dateutil-2.2-py2.7.egg-info                  six-1.6.1-py2.7.egg-info
ghost                                               pytz                                                six.py
ipython-1.2.1-py2.7.egg-info                        pytz-2013.7-py2.7.egg-info                          six.pyc
logilab                                             redis                                               sklearn
logilab_common-0.60.0-py2.7-nspkg.pth               redis-2.8.0-py2.7.egg-info                          statsmodels
logilab_common-0.60.0-py2.7.egg-info                scikit_learn-0.14.1-py2.7.egg-info                  statsmodels-0.5.0-py2.7.egg-info
matplotlib                                          scikits                                             tests
nose                                                scikits.statsmodels-0.3.1-py2.7-nspkg.pth           tornado
nose-1.3.1-py2.7.egg-info                           scikits.statsmodels-0.3.1-py2.7.egg-info            tornado-3.2-py2.7.egg-info
numpy                                               scipy                                               wx-2.9.5-osx_cocoa
numpy-1.7.1-py2.7.egg-info                          scipy-0.12.0-py2.7.egg-info                         wx.pth
numpy-1.8.0-py2.7.egg-info                          scipy-0.13.3-py2.7.egg-info                         wxPython_common-2.9.5.0-py2.7.egg-info
pandas                                              selenium                                            wxversion.py
pandas-0.12.0-py2.7.egg-info                        selenium-2.39.0-py2.7.egg-info
patsy                                               setuptools-0.6c11-py2.7.egg-info

Your pip command show python from /usr/local/lib/python2.7 , while during installation it's /usr/local/Cellar/python/2.7.5/

Is it a symlink or a different path?

Okay, the problem was that somehow the old packages were preserved. Therefore, I simply went into the directoy and removed the corresponding packages.

Here is what I did:

sh-3.2# pip list | grep numpy
numpy (1.7.1)
sh-3.2# pwd
/usr/local/lib/python2.7/site-packages
sh-3.2# rm numpy*
sh-3.2# pip install numpy
sh-3.2# pip list | grep numpy
numpy (1.8.0)

Now it works fine!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM