Basic pip3 commands

pip (also known as pip3 in Python 3) is a package management system written in Python and is used to install and manage Python packages.

If you are running Python 3 (which you probably/should), the use pip3 as opposed to pip. If you use pip3, you can be sure that the module will be installed in Python 3 and won't be available on Python 2.

Here are a few commands that have become somewhat indispensable for me.

# show python version
python3 --version

# show pip version
pip3 --version

# install a package
pip3 install openai

# upgrade a package
pip3 install openai --upgrade

# install a specific version of a package
pip3 install openai==0.8.0

# show the latest version of the package installed
pip3 show openai

# show all versions of the package installed
pip3 index versions openai

# list all packages installed
pip3 list

# uninstall the latest version of the package
pip3 uninstall openai

# upgrade pip
pip install --upgrade pip