ModuleNotFoundError
Traceback (most recent call last)
<ipython-input-1-7603de2dfef5> in <module>
1 import requests
2 import json
----> 3 import oauth2
ModuleNotFoundError: No module named 'oauth2'
CodePudding user response:
It seems like you have not installed the oauth2 library.
The documentation is available at https://pypi.org/project/python-oauth2/
Make sure you have installed the library. Just in case, run this command:
pip install python-oauth2
CodePudding user response:
It seems oauth2
has not been installed, or at least it is not installed in the python environment that you are using.
Try this command in a new cell -
!pip install oauth2
Restart the kernel and then try executing the code.
CodePudding user response:
Whenever you encounter this:
ModuleNotFoundError: No module named 'name'
It means that you do not have installed the module that you're trying to import, as stated by previous answers, you have to install said module in the environment you're working on. In this case it seems you need to install oauth2 in jupyter notebook (or at least that's what the question tags make me think), so you can try this:
Create another block above the lines importing modules
Depending on your python version or the IDE you're using, try one of the following:
python -m pip install oauth2
python3 -m pip install oauth2
pip install python-oauth2
!pip install python-oauth2
Another option if you're working on a conda environment is to open the anaconda navigator and directly search and install the module on the "Environments" window.