Python is not just a programming language for beginners – it is a powerful and complete language, on the basis of which a huge number of third-party packages and libraries are created. Instead of coding everything yourself, you can deploy these third party packages and use them as part of your own coding projects.
You can find them by searching on GitHub or on the web, but you can also use PIP, the package manager for Python, instead. PIP allows you to search and install Python packages PIP from the Python Package Index with thousands of packages available.
What is PIP?
PIP, or Python Package Installer, allows you to install packages from a central repository of Python packages available in the Python Package Index In simple terms, it acts as a Python app store, allowing you to install Python packages from the command line or terminal without having to search for them yourself.
Linux users are already familiar with this process: package managers are an integral part of the Linux user experience, and APT, Pacman, and others. Allow you to install various software on different Linux distributions from a terminal window.
Before you can use PIP, you need Python installed. MacOS and most Linux distributions already have Python installed, but you will need to install it manually on Windows 10. This will also be required if your Linux distribution does not have Python installed (or an older version of Python is installed.) Using the package manager for your distribution kit.
Install Python PIP on Linux
The python-pip package is available for download and installation for all major Linux distributions, as are its variants. Depending on your Linux distribution, you may need to install the python2-pip package if you are still using the Python 2.x series and not the Python 3.x series.
– /
If you are using Python 3.4 or later (or Python 2.7.9 or later), you do not need to install PIP on Linux as it is already installed. Test this by opening a terminal window and typing python3 –version to check your installed Python version, then use python -m pip or python3 -m pip to use it.
For Python versions below 2.7.9 or 3.4, the installation of Python PIP on Linux will depend on the system package manager used. Here’s how to install PIP on various Linux platforms.
- To install Python PIP on Ubuntu or Debian based distributions, open a terminal and type sudo apt install python-pip for Python 2.x. Enter sudo apt install python3-pip for Python 3.x installations.
- On Arch Linux, open a terminal and type sudo pacman -S python2-pip for Python 2.x. Enter sudo pacman -S python-pip to install Python 3.x.
- If you are using a Fedora based distribution, type sudo dnf upgrade python-setuptools followed by sudo dnf install python-pip python -wheel for Python 2.x. Enter sudo dnf install python3 python3-wheel to install Python 3.x.
- To manually install PIP, open a terminal and type curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py. Once downloaded, enter python get-pip.py to run the unattended installation script.
Install Python PIP on Windows
Unlike Linux, Windows does not have Python installed. This means that you need to download and install Python for Windows first before you can start using PIP on this platform.
If you have installed the most recent version of Python, then PIP should be installed with your Python installation. As we mentioned, when installing Python 2.7.9 and Python 3.4 (or higher), PIP should be installed automatically.
If you are using an older version of Python, you will need to use the get-pip script to automatically install pip.
- Download the get-pip.py script on your Windows PC. In elevated PowerShell or at a command prompt with administrative access, enter python get-pip.py to automatically install the PIP.
This should automatically install Python PIP to use. Then you can run it from PowerShell or a command prompt window by typing pip or python -m pip.
How to install Python PIP on macOS
Like Linux, macOS usually comes with Python installed as well as a PIP version. Both Python and PIP on macOS are probably outdated compared to the most recent release, but it should work as usual by opening a macOS terminal window and typing pip or python -m pip (or pip3 or python3 -m pip).
If you want to update Python and PIP together, you can easily do so using the Homebrew Package Manager for macOS.
- If you have Homebrew installed, open a terminal window and type brew install python to update your installation to the latest version of Python 3.x. To install an older version of Python 2.x, type brew install python @ 2 instead.
After installing it, type pip or python -m pip (or pip3 or python3 -m pip) in the manual to start PIP and see a list of available PIP flags.
PIP Update
If you already have PIP installed but would like to update to the latest version, you can do so using the PIP itself.
- For macOS and Linux users, enter pip install -U pip to start the upgrade process. You can also use pip3 install -U pip or python -m pip install -U pip instead.
- Windows users can install Python PIP by opening PowerShell or a command prompt with administrator privileges and typing python -m pip install -U pip.
Install and Uninstall Python Packages using PIP
Once the PIP is installed, updated and ready to use on your platform of choice, you can finally start using it to download and install Python packages, or use it to remove existing packages.
- To install a new Python package using PIP, enter pip install package or python -m pip install package, replacing package with the name of the package. You may need to use pip3 or python3 on certain platforms such as macOS if you have Python 2.x and Python 3.x installed.
- To see a list of all installed Python packages, enter pip list or python -m pip list. Use pip3 or python3 for Python 3.x packages on specific platforms.
- To uninstall a package, enter pip uninstall package or python -m pip uninstall package, replacing package with the name of the package. Use pip3 or python3 on specific platforms if you have Python 2.x and 3.x installed. Press y to confirm deletion.
Use PIP to develop better Python projects
Once you learn how to install Python PIP and use it to install new packages, you immediately have access to an infinite number of libraries and other projects that will allow you to develop larger and better native projects using Python.
Python is one of the best programming languages ??to learn, especially for beginner programmers, thanks to its easy-to-understand syntax and endless beginner resources.
Whether you are a new Python programmer or a pro, there is always a lot to learn, so let us know your own Python tips (or questions) in the comments section below.
–
Comment on “How To Install Python PIP For Python Packages”