ModuleNotFoundError: No module named 'requests' after pip install [duplicate]

I know similar questions have been asked before but I couldn't find the solution to my problem.

I am getting the following error message after trying to import requests:

C:\Users\Jm\PycharmProjects\Test\venv\Scripts\python.exe C:/Users/Jm/PycharmProjects/Test/Test_001
Traceback (most recent call last):
  File "C:/Users/Jm/PycharmProjects/Test/Test_001", line 1, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

I only have one version of python installed and python -m pip install requests is saying all the requirements are already satisfied.


Solution 1:

Run this code:

C:\Users\Jm\PycharmProjects\Test\venv\Scripts\python.exe -m pip install requests

This forces the installation directory to your python install.

This gives a much different effect than simply python -m pip install requests

Solution 2:

As @Daniel Scott mentioned before use the command mentioned above or below

$: path-to-your-python-command -m pip install name-of-module

If you are using linux/mac then you can find path-to-your-python command using:

$: which python3

/usr/bin/python3

Lets say your python is installed here /usr/bin/python3 and the module you are installing is requests. Then you can use:

$: /usr/bin/python3 -m pip install requests