How to Install PIP in Windows to Manage Python Packages
If you choose to read this article now, you are surely a programmer or developer, and you are definitely familiar with the Python programming language. Python is a general-purpose, high-level, and Object-Oriented programming language. From beginner to professional programmers, they have experience using Python because it is one of the most straightforward and efficient programming languages for interacting with computers. Python is widely used in software development, web applications, machine learning, system scripting, artificial intelligence, etc. As a result, there is no one among the developers who has not used Python’s features to automate and optimize their daily tasks.
PIP (PIP Installs Packages) is a package management system for Python that allows developers to efficiently control, update, and manage Python packages, including various frameworks, libraries, and tools, and easily install them from the Python Package Index (PyPI) and other sources. Developers who use the Windows system, knowing the importance of using PIP to manage Python packages, try to equip the Windows system with PIP; if you are one of this category of users, you made the right choice because this article will teach you how to install PIP in Windows to manage Python packages step by step.
As we previously taught how to install PIP on Ubuntu for Linux users, in this article, we are targeting Windows users, and we will provide a useful guide to install PIP on Windows. Stay with us until the end of the article.
Advantages of installing PIP in Windows
- Facilitating and optimizing the installation, updating, removal, and management of Python packages (libraries, frameworks, and tools) from the Python Package Index (PyPI)
- Automatically resolving and installing package dependencies and reducing compatibility problems
- Exact version control of a package to install and maintain project stability
- Create and manage Virtual Environments to create separate development environments to avoid conflicts between packages
- Facilitating distribution by providing the ability to package Python libraries and share code within the Python community
- Facilitating and automating tasks such as continuous integration, setting up development and deployment environments through integration in scripts and automated workflows
- Integration with IDEs (integrated development environments)
PIP installation prerequisite in Windows
In order to be able to install PIP on Windows through the instructions in this article, you must have a Windows system or Windows VPS to equip your Windows system with PIP. Since virtual environments are recommended for installing PIP and benefiting from the best PIP performance, buying a Windows VPS is the ideal option for developing and using PIP features. In addition, since PIP is a package management system for Python, first, you have to install python on windows VPS. You should also be able to access the Command Prompt window with system administrator privileges.
A quick guide to install PIP in Windows
After considering the minimum prerequisites for installing PIP on Windows, you will increase your development productivity and efficiency by following the steps to install PIP on Windows.
1. Check if PIP is installed
Sometimes, when installing Python 2.7.9+ and Python 3.4+, PIP is automatically installed along with Python and is available through the command line. If you have already installed Python in Windows, open the Command Prompt window (press windows key+X > click Run > type cmd.exe) and check if PIP is already installed by entering the following command:
pip --version
Or
pip help
Output:
‘pip’ is not recognized as an internal or external command, operable program, or batch file.
If information about the PIP version is displayed, ensure Python has been installed on your Windows, but if you do not receive output or get a “program could not be found” error, you should install PIP on Windows by following the steps in this article.
2. Download PIP
To install PIP in Windows, you need to download the get-pip.py file, which is a bootstrapping script for installing PIP in Python environments, by running the following command in the Windows command prompt:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
3. Install PIP in Windows
After downloading the get-pip.py file, install PIP by running the following command:
python get-pip.py
This command will run the bootstrapping script and install PIP in the Python environment on Windows.
Troubleshooting: One of the common errors during PIP installation in Windows is not finding the get-pip.py file. To solve this problem, check the path of the directory where the file is saved and use thedir
command to check the contents of the current directory.
Note: If you are using an old version of Python on Windows, you must get the correct version of the file from pypa.io. Then, after downloading, save the get-pip.py file in the directory where Python is already installed. Change the current directory path on the command line to the directory path where you just saved the file and run thePython get-pip.py
command. As a result, you have manually installed PIP in Windows.
4. Verify PIP Installation
After installing PIP in Windows, run the following commands to confirm that PIP is installed correctly:
pip --version
Or
pip help
If you get information about the PIP version or a list of PIP-related commands and the software package’s location, ensure that PIP has been installed successfully.
5. Configure Windows to use pip
To use PIP in Windows without getting the “not on PATH” error, you must add PIP to the Windows environment variables. For this purpose, follow the steps below:
- Open the Control Plane and select “System and Security” from the window’s left pane.
- Select System settings > Advanced system settings.
- Click the Environment Variables and double-click the “Path” variable Under “System Variables.”
- Click “New,” add the directory that contains PIP (e.g., C: Python34Scripts), and click “OK.”
Note: The %HOME%\pip\pip.ini file is the PIP configuration file in Windows, and you can set a different path for the PIP configuration file using the PIP_CONFIG_FILE environment variable.
6. Upgrade Python pip on Windows for security purposes
Using the latest version of PIP brings advantages such as improved performance and security features, etc., that’s why we recommend upgrading PIP to the newest version:
python -m pip install --upgrade pip
By running the previous command, the old version of PIP will be uninstalled in Windows, and PIP will be upgraded to the latest version.
If the performance of the new version of PIP in your Windows system is disturbed and your system is not compatible with the latest version, you can downgrade PIP to the previous version or a specific version:
python -m pip install pip==version_number
Conclusion
That’s it! You’ve successfully installed PIP on your Windows system. By installing PIP on Windows, developers will benefit from a versatile and powerful tool for managing packages, dependencies, and development environments, and development efficiency will increase significantly. In addition, the stability and reliability of a project will be maintained. By spending a limited time, you can learn how to use pip in the command line through the available commands and options. You will get information about the specific command by checking the output of thepip help
orpip <command> --help
command.
The User Guide for using the pip page is useful for learning how to use pip. If you have any questions about installing pip on Windows, share your questions with us in the comments section so that we can respond as soon as possible.
We hope you enjoyed reading this article.