pip not found windows code example

Example 1: pip not found after installation

#for pip, and not pip3:
sudo apt-get install python-pip

Example 2: 'pip' is not recognized as an internal or external command, operable program or batch file.

py -m pip install [packagename]

Example 3: pip not found

python -m ensurepip

##possibly the best way to autmatically install pip, if it is not found

Example 4: command not found: pip

apt-get install python3-pip

Example 5: add pip to path

import os
import sys
pipPath = f'{os.path.dirname(sys.executable)}\\Scripts'
os.system(f'setx PATH "%PATH%;{pipPath}"')

Example 6: pip is not a batch command but python is installed

python -m pip install [packagename]