pip refuses to upgrade

后端 未结 3 1409
被撕碎了的回忆
被撕碎了的回忆 2021-01-19 06:09

I currently have installed pip 8.1.2.

So I want to upgrade it to the latest version (9.0.1) and I execute:

sudo pip install --upgrade pip


Collectin         


        
相关标签:
3条回答
  • 2021-01-19 06:51

    If above are not working, please try this it works(I had similar situations and this works):

    1. download get-pip.py: curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

    2. Run the downloaded file: python get-pip.py

      Above uninstalls the old version and install the latest ones. Reference Link: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py

    0 讨论(0)
  • 2021-01-19 06:53

    The Ubuntu pip version has been patched to prevent self-upgrades (all installation into system-managed files are prevented, the patch is named hands-off-system-packages.patch). You are supposed to use the Ubuntu packaging system to upgrade instead. The feedback provided could be improved certainly.

    As there is no Ubunutu package of pip 9.0.1 available yet for your Ubuntu version, you can't actually upgrade to a newer version this way (there is a version for Zesty however).

    A (ugly) work-around is to use easy_install instead:

    sudo easy_install -U pip
    

    This works because easy_install has not been booby-trapped to prevent the upgrade. However, this'll replace system managed files with the newer pip version. If your package manager were to re-install the python-pip package, it'll happily overwrite those files and you could in theory end up with a broken installation. Also, easy_install adds more files than the package would, and those extra files could cause issues later down the line, especially when you upgrade python-pip later when a new version is packaged.

    If you were to use a virtualenv, you are free to upgrade pip inside that, which works just fine.

    0 讨论(0)
  • 2021-01-19 06:55

    Had a similar issue with pip not wishing to upgrade, though I'm not keen on replacing the package manager's version and as I'm always adding the --user option on installations via pip I figured "what's the harm?" in doing the same with pip on itself.

    pip install --user --upgrade pip
    

    It'll only work for one user but for some use cases that is just peachy.

    0 讨论(0)
提交回复
热议问题