Open In App

How to install requests in Python – For windows, linux, mac

Improve
Improve
Like Article
Like
Save
Share
Report

Requests is an elegant and simple HTTP library for Python, built for human beings. One of the most famous libraries for python used by developers al over the world. This article revolves around how one can install requests library of python in Windows/ Linux/ macOS, etc.

Installation

Windows

For installing requests in windows, one would require Python (preferably latest version), so if you don’t have python installed, head to – How to download and install Python Latest Version on Windows. Now open command prompt from the windows and run following command –

python -m pip install requests

Booom..!! Done Now, requests library is downloaded successfully.

Linux

For installing requests in linux, one would require Python (preferably latest version) and pip latest version, so if you don’t have python installed, head to – How to download and install Python Latest Version on Linux. To install pip in linux – How to install PIP in Linux?. Now run,

pip install requests

macOS

For installing requests in mac, one would require Python (preferably latest version) and pip latest version, so if you don’t have python installed, head to – How to download and install Python Latest Version on mac. To install pip mac Os. Run,

sudo easy_install pip
sudo pip install --upgrade pip 

Now to install requests,

pip install requests

Alternative common method

THe last method for installation of requests on any operating system is to grab the base files and install requests manually and Requests is actively developed on GitHub, where the code is always available. For code – visit here.
You can either clone the public repository:

git clone git://github.com/psf/requests.git

Or, download the tarball:

curl -OL https://github.com/psf/requests/tarball/master
# optionally, zipball is also available (for Windows users).

Once you have a copy of the source, you can embed it in your own Python package, or install it into your site-packages easily:

cd requests
pip install .

For documentation of requests library – visit here


Last Updated : 06 Oct, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads