Loading...
Loading...
ModuleNotFoundError: No module named 'requests'Python can't find the module you're trying to import. Either the package isn't installed, it's installed in a different Python environment, or there's a naming conflict with a local file.
Use pip to install the package in the correct environment.
# Install the package
pip install requests
# If you have multiple Python versions, use pip3
pip3 install requests
# Or use python - m pip to ensure correct environment
python - m pip install requestsMake sure you're working inside the correct virtual environment.
# Create a virtual environment
python - m venv venv
# Activate it(Windows)
venv\Scripts\activate
# Activate it(Mac / Linux)
source venv / bin / activate
# Then install your packages
pip install requestsMake sure you don't have a local file with the same name as the module.
# If you have a file called requests.py, rename it
# Python will import your local file instead of the package