{"id":3848,"date":"2020-03-06T05:35:31","date_gmt":"2020-03-06T05:35:31","guid":{"rendered":"https:\/\/www.askpython.com\/?p=3848"},"modified":"2022-07-20T13:02:35","modified_gmt":"2022-07-20T13:02:35","slug":"python-pip","status":"publish","type":"post","link":"https:\/\/www.askpython.com\/python-modules\/python-pip","title":{"rendered":"Python PIP &#8211; Package Manager"},"content":{"rendered":"\n<p>Python programming language is divided into different packages and modules. Apart from the core Python installation, we can install third-party modules to help us in our project development. The python package manager, which helps us in installing and uninstalling these packages\/modules is called PIP.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">What is PIP?<\/h2>\n\n\n\n<p><strong>PIP<\/strong> is a <strong>python package manager<\/strong> that helps us to install, review and use various packages\/modules in Python programming.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Installing PIP<\/h2>\n\n\n\n<p>In order to work with PIP, we need to download and set up the PIP on our system. Make sure that Python is already installed in your system. That&#8217;s a prerequisite for installing PIP.<\/p>\n\n\n\n<p>PIP can be installed on different platforms. Let&#8217;s see how to install it on Windows, Linux, and Mac OS.<\/p>\n\n\n\n<p class=\"has-vivid-cyan-blue-background-color has-text-color has-background\" style=\"color:#ffffff\">PIP comes bundled with Python installers i.e. versions 2.7.9+ or 3.10+. You will need to explicitly install it if you are on the older version or if you want to update it. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Installing PIP on Windows<\/h3>\n\n\n\n<p>We need to download the <strong>PIP installation file<\/strong> to install it on Windows.<\/p>\n\n\n\n<p><strong>You can copy the installation script from this link:  <\/strong><a href=\"https:\/\/bootstrap.pypa.io\/get-pip.py\" class=\"rank-math-link\" target=\"_blank\" rel=\"noopener\">https:\/\/bootstrap.pypa.io\/get-pip.py<\/a> <\/p>\n\n\n\n<p>Copy the content from the above <strong>URL <\/strong>and save it with the name <strong>get-pip.py<\/strong>, after which you need to open the <strong>command prompt <\/strong>and cd into the directory where the <strong>get-pip.py<\/strong> file is saved and run the file.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ python get-pip.py\n<\/pre><\/div>\n\n\n<p>After installation, run the below command to check whether PIP has been successfully installed on your system or not.<\/p>\n\n\n\n<p><strong>Syntax:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n$ pip\n<\/pre><\/div>\n\n\n<p><strong>Output<\/strong>: The output should show you how to use PIP and what are the general options and commands that we can use with PIP.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1421\" height=\"792\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-installation.png\" alt=\"PIP Installation\" class=\"wp-image-3883\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-installation.png 1421w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-installation-300x167.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-installation-1024x571.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-installation-768x428.png 768w\" sizes=\"auto, (max-width: 1421px) 100vw, 1421px\" \/><figcaption>PIP Installation<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">2. Installing PIP on Ubuntu<\/h3>\n\n\n\n<p><strong>Syntax:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ sudo apt-get install python-pip\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">3. Installing PIP on Mac OS<\/h3>\n\n\n\n<p>We can use easy_install to install PIP too. Actually, both of them are package managers and PIP has replaced the easy_install utility.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ sudo easy_install pip\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Upgrading PIP<\/h2>\n\n\n\n<p>If you want to upgrade the PIP, run the following command.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# python3 -m pip install --user --upgrade pip\n<\/pre><\/div>\n\n\n<p>The &#8211;upgrade option is used to upgrade the PIP to the latest version if the pip is already installed. If you will run it for the first time when pip is not installed, it will install the latest version of pip. So, running this command will ensure that your system has latest PIP version.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Downloading a package with PIP<\/h2>\n\n\n\n<p>Python consists of various modules and packages that can be downloaded and accessed using PIP.<\/p>\n\n\n\n<p><strong>Syntax:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\npip install package-name\n<\/pre><\/div>\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\npip install pkglts\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"230\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-install-command-1024x230.png\" alt=\"PIP install Command\" class=\"wp-image-3891\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-install-command-1024x230.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-install-command-300x68.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-install-command-768x173.png 768w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-install-command-1536x346.png 1536w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-install-command.png 1653w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>PIP install Command<\/figcaption><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Pip List Packages<\/h2>\n\n\n\n<p>If you wish to have a look at the installed packages in your system, the below command can help you out with it.<\/p>\n\n\n\n<p>Pip list command displays the installed packages along with their versions.<\/p>\n\n\n\n<p><strong>Syntax:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ pip list\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"464\" height=\"669\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-list-packages.png\" alt=\"PIP List Packages\" class=\"wp-image-3886\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-list-packages.png 464w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-list-packages-208x300.png 208w\" sizes=\"auto, (max-width: 464px) 100vw, 464px\" \/><figcaption>PIP List Packages<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">PIP uninstall package<\/h2>\n\n\n\n<p>The pip uninstall command with the package name is used to remove a package from the Python installation.<\/p>\n\n\n\n<p><strong>Syntax:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ pip uninstall package-name\n<\/pre><\/div>\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ pip uninstall camelcase \n<\/pre><\/div>\n\n\n<p>Further, you will be asked for your consent whether you really want to uninstall the selected package. Enter &#8216;y&#8217; to proceed.<\/p>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"179\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-unistall-package.png\" alt=\"PIP Uninstall Package\" class=\"wp-image-3887\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-unistall-package.png 956w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-unistall-package-300x56.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-unistall-package-768x144.png 768w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><figcaption>PIP Uninstall Package<\/figcaption><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Commands supported by PIP<\/h2>\n\n\n\n<p>PIP contains a lot of commands to analyze and work with the Python modules and packages.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. pip help<\/h3>\n\n\n\n<p>The following command can be used to get information about the commands supported by <strong>PIP <\/strong>itself.<\/p>\n\n\n\n<p><strong>Syntax:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ pip help\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"504\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-help-command-1024x504.png\" alt=\"PIP help Command\" class=\"wp-image-3888\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-help-command-1024x504.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-help-command-300x148.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-help-command-768x378.png 768w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-help-command-1536x756.png 1536w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-help-command.png 1632w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>PIP help Command<\/figcaption><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">2. pip search package<\/h3>\n\n\n\n<p>We may sometimes not know the exact package name and Python PIP has a solution for that too. We can easily search for a package in the PIP repository using the following command.<\/p>\n\n\n\n<p><strong>Syntax:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ pip search package-name\n<\/pre><\/div>\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ pip search Flask\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1266\" height=\"218\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-search-command.png\" alt=\"PIP search Command\" class=\"wp-image-3894\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-search-command.png 1266w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-search-command-300x52.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-search-command-1024x176.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-search-command-768x132.png 768w\" sizes=\"auto, (max-width: 1266px) 100vw, 1266px\" \/><figcaption>PIP search Command<\/figcaption><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">3. pip show package info<\/h3>\n\n\n\n<p>If you wish to fetch the information about the installed package\/module such as the location of storage and the latest version, then PIP can help us out with it using the below command.<\/p>\n\n\n\n<p><strong>Syntax<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ pip show package-name\n<\/pre><\/div>\n\n\n<p><strong>Example<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ pip show Flask\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"948\" height=\"206\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-show-command.png\" alt=\"PIP show Command\" class=\"wp-image-3896\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-show-command.png 948w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-show-command-300x65.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/03\/PIP-show-command-768x167.png 768w\" sizes=\"auto, (max-width: 948px) 100vw, 948px\" \/><figcaption>PIP show Command<\/figcaption><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Python pip vs venv<\/h2>\n\n\n\n<p>Python pip is used to manage packages at the system level. But, we can manage packages at the project level too using <a href=\"https:\/\/www.askpython.com\/python\/examples\/virtual-environments-in-python\" data-type=\"post\" data-id=\"11337\">venv<\/a>. The venv command creates virtual environments that are tied to a specific project. We can activate the virtual environment and then use the pip command to install packages only for that virtual environment. It comes in handy when we are working on multiple projects and don&#8217;t want to mix up their package dependencies.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>Python PIP utility helps us in managing our Python installation modules and packages. We can search a package, and install and uninstall it using the pip command. We can also list out all the installed modules and packages with their versions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.askpython.com\/python-modules\/python-modules\" data-type=\"post\" data-id=\"1222\">Python Modules<\/a><\/li><li><a href=\"https:\/\/www.askpython.com\/python\/python-packages\" data-type=\"post\" data-id=\"390\">Python Packages<\/a><\/li><li><a href=\"https:\/\/www.askpython.com\/python\/python-modules-vs-python-packages\" data-type=\"post\" data-id=\"16550\">Python Modules vs Packages<\/a><\/li><li><a href=\"https:\/\/www.askpython.com\/python\/data-analytics-libraries\" data-type=\"post\" data-id=\"17234\">Python Data Analytics Libraries<\/a><\/li><li><a href=\"https:\/\/www.askpython.com\/python-course-for-beginners\" data-type=\"page\" data-id=\"18525\">Python Course for Beginners<\/a><\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">References<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><strong style=\"font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 1rem; background-color: var(--ast-global-color-5);\"><a class=\"rank-math-link\" href=\"https:\/\/pypi.org\/project\/pip\/\" target=\"_blank\" rel=\"noopener\">PIP<\/a><\/strong><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Python programming language is divided into different packages and modules. Apart from the core Python installation, we can install third-party modules to help us in our project development. The python package manager, which helps us in installing and uninstalling these packages\/modules is called PIP. What is PIP? PIP is a python package manager that helps [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":3903,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-3848","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-modules"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/posts\/3848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/comments?post=3848"}],"version-history":[{"count":0,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/posts\/3848\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/media\/3903"}],"wp:attachment":[{"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/media?parent=3848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/categories?post=3848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/tags?post=3848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}