Can I force pip to reinstall the current version?

前端 未结 7 1885
Happy的楠姐
Happy的楠姐 2020-11-27 09:07

I\'ve come across situations where a current version of a package seems not to be working and requires reinstallation. But pip install -U won\'t touch a package

相关标签:
7条回答
  • 2020-11-27 09:32
    pip install --upgrade --force-reinstall <package>
    

    When upgrading, reinstall all packages even if they are already up-to-date.

    pip install -I <package>
    pip install --ignore-installed <package>
    

    Ignore the installed packages (reinstalling instead).

    0 讨论(0)
  • 2020-11-27 09:35
    --force-reinstall
    

    doesn't appear to force reinstall using python2.7 with pip-1.5

    I've had to use

    --no-deps --ignore-installed
    
    0 讨论(0)
  • 2020-11-27 09:38

    In the case you need to force the reinstallation of pip itself you can do:

    python -m pip install --upgrade --force-reinstall pip
    
    0 讨论(0)
  • 2020-11-27 09:39

    If you want to reinstall packages specified in a requirements.txt file, without upgrading, so just reinstall the specific versions specified in the requirements.txt file:

    pip install -r requirements.txt --ignore-installed
    
    0 讨论(0)
  • 2020-11-27 09:42
    sudo pip3 install --upgrade --force-reinstall --no-deps --no-cache-dir <package-name>==<package-version>
    

    Some relevant answers:

    Difference between pip install options "ignore-installed" and "force-reinstall"

    0 讨论(0)
  • 2020-11-27 09:46

    If you have a text file with loads of packages you need to add the -r flag

    pip install --upgrade --no-deps --force-reinstall -r requirements.txt
    
    0 讨论(0)
提交回复
热议问题