This confusion is common when we have installed more than one version of python
or use a virtualenv
to package libraries needed for a particular project. If you have more than one version of python
, then it means that you have a different set of libraries for each of these versions.
Now let’s go to one of the possible causes:
Depending on the IDE
that you are using, it may have settings to indicate which interpreter (binary version of python
) you want to use, as is the case of pycharm
that I use.
In this tab it is possible to see the interpreters that the IDE
recognized by default or I added. With this I suggest you check whether the IDE
points to the correct interpreter (which has the library requests
and be the version of python
that you want to use). If the interpreter you want to use is not showing up, then you need to add by the button add interpreter
.
I also recommend that you pass more information regarding the environment you are using, if you are running the program directly by a button of IDE
, if you actually owned more than one version of python
, or if you are using virtualenv
. If you can pass on this kind of information, it will make it easier for us to help you solve the problem.