我明白了:
from requests_oauthlib import OAuth2Session
ModuleNotFoundError: No module named 'requests_oauthlib'
我正在使用Windows 64位python 32位。知道为什么会这样吗?
按照以下方式安装:
C:\Users\Chea\zz>pip install requests requests_oauthlib
Requirement already satisfied: requests in c:\users\Chea\appdata\local\programs\python\python36-32\lib\site-packages
Requirement already satisfied: requests_oauthlib in c:\users\Chea\appdata\local\programs\python\python36-32\lib\site-packages
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\users\Chea\appdata\local\programs\python\python36-32\lib\site-packages (from requests)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\Chea\appdata\local\programs\python\python36-32\lib\site-packages (from requests)
Requirement already satisfied: idna<2.7,>=2.5 in c:\users\Chea\appdata\local\programs\python\python36-32\lib\site-packages (from requests)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\Chea\appdata\local\programs\python\python36-32\lib\site-packages (from requests)
Requirement already satisfied: oauthlib>=0.6.2 in c:\users\Chea\appdata\local\programs\python\python36-32\lib\site-packages (from requests_oauthlib)
这是一种解决方法,但几乎没有解决根本原因:sys.path.append('PTHONPATHTOSITEPACKAGES')