Readers like you help support MUO. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.
Like any programming language, Python supports third-party libraries and frameworks. You can use these to avoid reinventing the wheel with every new project. If you want to use them, you can find these Python libraries on a central repository called the Python Package Index (PyPI).
It can be a frustrating and time-consuming process to download, install, and manage these packages manually. Instead, many developers rely on a tool called PIP to make the entire procedure simple and error-free. Weâll show you how to install PIP for Python in Windows, Mac, and Linux.
What Is PIP for Python?
PIP is an acronym that stands for âPIP Installs Packagesâ or âPreferred Installer Program.â Itâs a package manager for Python that lets you manage PyPI packages not included with the standard Python distribution. PyPI hosts a large collection of frameworks, tools, and libraries for applications in finance, health, and more.
Is PIP Installed With Python?
If youâre using Python 2.7.9 (or greater), 3.4 (or greater), then PIP is already built into the Python installer. When you download the latest release, you should remember that a particular release isnât supported indefinitely.
According to Pythonâs development cycle, support for Python 3.4 ended in March 2019. This means that it has bypassed the end-of-life branch, and youâll no longer get security fixes. So youâll end up dealing with more significant changes in both Python and in libraries at the same time, which makes upgrading scary.
Is Python Correctly Installed?
You should make sure that Python is properly installed on your system. There are different ways to install Python: through a package manager or from the official Python website. While the installation is simple, it helps if youâre aware of the best practices for managing Python or itâs easy to make mistakes.
Install and Manage Python PIP for Windows
By default, the Python installer places its executables in your AppData directory, so it doesnât need admin permissions. Or you can specify a higher-level target directory (C:\Python3.9) to make it easier to find.
The installation process optionally adds this directory to the system PATH, so you donât have to configure anything. If you donât do this during installation, you can add Python to the Windows PATH variable later, manually.
If youâre using Chocolatey to install packages, make sure to avoid mixing that installation with a regular package on the same machine. To check the version of the installed Python, press Win + X and open Command Prompt. Then, type in:
py --version
To check the PIP version, type:
py -m pip --version
While PIP doesnât update often, itâs still important to stay on top of new versions for bug fixes, security fixes, and compatibility. To check for any upgrades, type in:
py -m pip install --upgrade pip
If you get a âPython is not definedâ message, then something has gone wrong during the installation process.
Install and Manage Python PIP for Mac
On manual installation, Python creates a folder in /Applications and installs its framework in /Library/Frameworks/Python.framework. This includes the Python executable and its libraries. The installer adds a symlink to this location under /usr/local/bin. If you only use Python occasionally, this setup works well.
Homebrew for Python Development
If youâre working on multiple Python projects, the default location, which needs sudo privileges, creates hurdles. Many people prefer to use Homebrew to install software packages, but should you use it for Python development? The problem with using Homebrew Python is that itâs not in your control.
Homebrew might upgrade your Pythonâe.g. 3.8 to 3.9âwithout your intervention. For example, the "youtube-dl" package uses Python as its dependency, the Python package may get updated as and when needed. You lose control over âsite-packagesâ and all the PIP packages that you had installed might become inaccessible.
Use Pyenv to Manage Python Installation
The Homebrew Python documentation recommends pyenv to manage Python environments. To make pyenv work, install build dependencies through Homebrew. Open Terminal, then type in:
brew install openssl readline sqlite3 xz zlib
Next, install pyenv:
brew install pyenv
Finally, update the shell profile configuration, i.e ~/.zshrc if your default shell is ZSH. Add the following lines:
echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
Quit Terminal and restart.
If you want to see all the versions of Python that pyenv can install for you, type in:
pyenv install --list
To install a specific Python version, type
pyenv install 3.9.7
Itâll take a bit of time for installation to get completed. Letâs assume that a project requires 3.8.12, a version that is not installed on the system. Letâs install this version through pyenv
pyenv install 3.8.12
You can see what versions of Python you have installed with
pyenv versions
âsystemâ version is the one that comes with Mac, i.e., Python 2.7. Since it is deprecated, letâs forget about it. Now tell pyenv the default version you want to use.
You can set Python versions at three levels: Global, Local, and Shell. Read the pyenv documentation for more details. To set it globally, type:
pyenv global 3.9.7
The global level sets the Python version for all shells and directories. Check what happens when you check the current Python version.
python3 --version
To check the PIP version, type in:
python3 -m pip --version
And if you wish to check for any updates to PIP, type:
python3 -m pip install --upgrade pip
The local level changes the Python version only for the current folders and subfolders. So if a project requires Python 3.8.12, type in:
pyenv local 3.812
This command configures a specific Python version in the local folder without changing the global one.
Install and Manage Python PIP for Linux
Many Linux distributions come packaged with Python, but it may not be the latest version. To find out which Python version you have, open the Terminal and type in:
python3 --version
If you have Python installed on your machine, then one of these commands should respond with a version number. If you want to install the Python distribution on Linux, the built-in package manager is probably the best method.
Advanced Package Tool for Ubuntu or Debian-based Distributions
sudo apt install python3-pip
Pacman Package Manager for Arch Linux
sudo pacman -S python-pip
Dandified Yum for Fedora-based Distributions
sudo dnf install python3-pip python3-wheel
Zypper Package Manager for openSUSE
sudo zypper install python3-pip python3-setuptools python3-wheel
Yum Package Manager for CentOS and Red Hat Enterprise Linux
sudo yum install python3 python3-wheel
Install and Configure Virtual Environment
Once you have a base installation of a Python setup, donât start installing packages directly into it with PIP. Thatâs because every project on your system will use a central site-packages directory to store and retrieve packages. This may often be what you want, but if you have two projects requiring different libraries, it can be a problem.
Since Python stores only one global version of a library, you should create isolated environments for your projects.
Manage Python Packages With PIP
Once your PIP workflow is ready, you can start installing packages from PyPI.
Install
# Mac
python3 -m pip install "SomeProject"
â
# Windows
py -m pip install "SomeProject"
Install a Specific Version
# Mac
python3 -m pip install "SomeProject=1.0"
â
# Windows:
py -m pip install "SomeProject=1.0"
Upgrade
# Mac
python3 -m pip install --upgrade "SomeProject"
â
# Windows
py -m pip install --upgrade "SomeProject"
Uninstall
# Mac
python3 -m pip uninstall "SomeProject"
â
# Windows
py -m pip uninstall "SomeProject"
List Installed Packages
# Mac
python3 -m pip list
â
# Windows
py -m pip list
List Outdated Packages
# Mac
python3 -m pip list --outdated
â
# Windows
py -m pip list --outdated
Learn More About Python
Python is a useful language with applications ranging from web development to data analysis. Itâs important to set up Python correctly so that your programming is smooth and error-free.
The best way to learn Python is by building projects. Read our guide on scraping a website with the beautiful soup Python library.
FAQs
How install pip Linux and Windows? âș
Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process.
How to install Python pip in Linux? âș- Start by updating the package list using the following command: sudo apt update.
- Use the following command to install pip for Python 3: sudo apt install python3-pip. ...
- Once the installation is complete, verify the installation by checking the pip version: pip3 --version.
To install PIP using ensurepip:
Open the Mac Terminal app via the Launchpad. In the Terminal, type python -m ensurepip or python3 -m ensurepip and press Enter. If PIP is missing, ensurepip will install PIP. Follow any additional on-screen instructions to complete this process.
- Check If Python Is Available. ...
- Check If PIP Is Already Installed. ...
- Download PIP. ...
- Install PIP on Windows. ...
- Verify the PIP Installation Process and Check the PIP Version. ...
- Add PIP to Windows Environment Variables.
The current version of pip works on: Windows, Linux and MacOS. CPython 3.7, 3.8, 3.9, 3.10 and latest PyPy3.
Where is pip install in Linux? âșInstalling pip on Linux
To install pip, go to https://bootstrap.pypa.io/get-pip.py. Save the file if you're prompted to do so; if the code for get-pip.py appears in your browser, copy and paste the entire program into your text editor and save the file as get-pip.py.
Run python get-pip.py . 2 This will install or upgrade pip. Additionally, it will install setuptools and wheel if they're not installed already. Be cautious if you're using a Python install that's managed by your operating system or another package manager.
How to install pip in Linux using yum? âș- Step 1: Update Repositories. If you updated the repositories in the previous section, skip to the next step. ...
- Step 2: Install Pip 2. To install Pip2, open the terminal window, enter the command: sudo yum ây install python2-pip. ...
- Step 3: Verify the Installation.
PIP is automatically installed with Python 2.7. 9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.
Why is pip install not working Mac? âșSometimes when you are installing packages, you might face the error: pip: command not found . This error could be due to the following reasons: Pip is not installed. Pip is installed, but it is not compatible with the current environment.
How to install Pip3 on Windows? âș
- Open the Control Panel and navigate to System.
- Click on Advanced system settings in the upper left panel.
- Click on Environment Variables.
- Under System Variables, scroll down then double-click the PATH variable.
- Click New, and add the directory where pip3 is installed,
Visit https://www.python.org/downloads/windows and download the installer based on your local machine's hardware architecture. The web-based installer needs an active internet connection. So, you can also download the standalone executable installer.
Why is pip not installed with Python? âșA âpip: command not foundâ error occurs when you fail to properly install the package installer for Python (pip) needed to run Python on your computer. To fix it, you will either need to re-install Python and check the box to add Python to your PATH or install pip on your command line.
How do I install both Windows 10 and Linux? âș- check if your PC's BIOS is in UEFI mode.
- partition your hard drive.
- optimize your hard drive.
- make a bootable USB drive.
- install Ubuntu Linux Distro along with Windows on your Windows 10 PC.
You can easily install PIP on Windows by downloading the installation package, opening the command line, and launching the installer. This tutorial will show how to install PIP on Windows, check its version, upgrade, and configure.
How to install pip on Ubuntu for Windows? âș- Step 1: You need to download PIP get-pip.py. You have to download get-pip.py before installing PIP. ...
- Step 2: Open the Windows Command Line. ...
- Step 3: Install PIP on Windows. ...
- Step 4: Check the PIP version. ...
- Step 5: Installation verification. ...
- Step 6: How to configure?
- Install Python.
- Type in the command âpip install managerâ
- Once finished, type the following: *pip install pandas* Wait for the downloads to be over and once it is done you will be able to run Pandas inside your Python programs on Windows. Comment. Comment. Comment.