Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install python requests on macos?

I am trying to install the requests package for Python 3.7 on Mac. I already have python 2.7 installed. I have read all the previous questions related to this and none of them could solve the issue.

pip3.7 install requests
bash: pip3.7: command not found
python3.7 -m pip install requests
/usr/local/bin/python3.7: No module named pip

I am not able to understand the issue here.

like image 526
QuickLearner Avatar asked Apr 30 '26 16:04

QuickLearner


2 Answers

If you installed python3 via brew, installing python libs globally is not allowed anymore:

pip3 install requests

Fails with the error: "This environment is externally managed"

brew install python-requests 

Fails with the error: "Error: python-requests has been disabled because it does not meet homebrew/core's requirements for Python library formulae! It was disabled on 2024-06-23"

Solution: Luckily the solution is stated in the first error message, you have to create a virtual environment instead of a globally installed lib with:

python3 -m venv path/to/venv
source path/to/venv/bin/activate
python3 -m pip install requests
like image 177
Simon Meyer Avatar answered May 02 '26 11:05

Simon Meyer


There’s no “pip3.7”, just “pip3”. Try this: pip3 install requests

like image 37
Jiri Volejnik Avatar answered May 02 '26 10:05

Jiri Volejnik