Python pip Command
Find package
py -m pip freeze | findstr py
Upgrade Pip
python -m pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
py -m pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
C:\Users\xxx\AppData\Local\Programs\Python\Python38\python.exe -m pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
Install Pip
py get-pip.py --trusted-host pypi.org --trusted-host files.pythonhosted.org
Pip Install command
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package> --user
py -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package> --user
some notes on new setup
python -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package> --user
install from whl
pip install some-package.whl
Add to path
C:\Users\xxx\AppData\Roaming\Python\Python37\Scripts
Use this to install from local drive
pip install ./downloads/PythonSetup3.8/flake8-3.8.3.tar.gz --trusted-host pypi.org --trusted-host files.pythonhosted.org
py -m pip install ./downloads/PythonSetup3.8/dateformat-0.9.7.tar.gz --trusted-host pypi.org --trusted-host files.pythonhosted.org --user
Install requirement
pip install -r requirements.txt --trusted-host pypi.org --trusted-host files.pythonhosted.org
python -m pip install -r requirements.txt --trusted-host pypi.org --trusted-host files.pythonhosted.org
When upgrading, reinstall all packages even if they are already up-to-date.
pip install --upgrade --force-reinstall <package> --trusted-host pypi.org --trusted-host files.pythonhosted.org
pip install --upgrade --force-reinstall --trusted-host pypi.org --trusted-host files.pythonhosted.org <package>
pip install -I <package>
pip install --ignore-installed <package>
Once in a while, a Python package gets corrupted on your machine and you need to force pip to reinstall it. As of pip 10.0, you can run the following:
This will force pip to re-install corrupted package
and all its dependencies.
pip install --force-reinstall <corrupted package>
If you want to re-download the packages instead of using the files from your pip cache, add the --no-cache-dir flag:
pip install --force-reinstall --no-cache-dir <corrupted package>
If you want to upgrade the package, you can run this instead:
pip install --upgrade <corrupted package>
The --upgrade flag will not mess with the dependencies of corrupted package
unless you add the --force-reinstall flag.
If, for some reason, you want to re-install corrupted package
and all its dependencies without first removing the current versions, you can run:
pip install --ignore-installed <corrupted package>
By the way, if you’re using a pip version that is less than 10.0, it’s time to update pip:
pip install --upgrade pip