Bootstrap FreeKB - PIP - Install package
PIP - Install package

Updated:   |  PIP articles

The pip list command will display the packages that have been installed using pip. In this example, pip will attempt to install packages into Python version 3.9.6.

~]$ pip list -v
Package      Version Location                                               Installer
------------ ------- ------------------------------------------------------ ---------
bcrypt       4.0.1   /usr/local/bin/python3.9.6/lib/python3.9/site-packages pip
cffi         1.16.0  /usr/local/bin/python3.9.6/lib/python3.9/site-packages pip
cryptography 41.0.5  /usr/local/bin/python3.9.6/lib/python3.9/site-packages pip
paramiko     3.3.1   /usr/local/bin/python3.9.6/lib/python3.9/site-packages pip
pip          21.1.3  /usr/local/bin/python3.9.6/lib/python3.9/site-packages pip
pycparser    2.21    /usr/local/bin/python3.9.6/lib/python3.9/site-packages pip
PyNaCl       1.5.0   /usr/local/bin/python3.9.6/lib/python3.9/site-packages pip
setuptools   56.0.0  /usr/local/bin/python3.9.6/lib/python3.9/site-packages pip

 

The pip install command can be used to install a package.

]$ pip install jsonpatch
Defaulting to user installation because normal site-packages is not writeable
Collecting jsonpatch
  Downloading jsonpatch-1.32-py2.py3-none-any.whl (12 kB)
Collecting jsonpointer>=1.9
  Downloading jsonpointer-2.3-py2.py3-none-any.whl (7.8 kB)
Installing collected packages: jsonpointer, jsonpatch
Successfully installed jsonpatch-1.32 jsonpointer-2.3

 

Or, you can list the packages that you want installed in a file, typically named requirements.txt.

jsonpatch==1.32

 

And then use the pip install command with the -r or --requirement option.

pip install --requirement requirement.txt

 

Sometimes, you'll want to use a specific version of Python, like this.

python3 -m pip install paramiko

 

The following can be used if you want to install a package in a specific version of Python.

/usr/bin/python3.6 -m pip install paramiko

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 487ea0 in the box below so that we can be sure you are a human.