Python 导入错误:无法导入名称';OAuth1Session';从';请求oauthlib';

Python 导入错误:无法导入名称';OAuth1Session';从';请求oauthlib';,python,django,twitter-oauth,tweepy,web-development-server,Python,Django,Twitter Oauth,Tweepy,Web Development Server,我是django框架的新手。我尝试使用tweepy通过twitter创建登录身份验证。在将提取的数据保存到数据库中时,我在OAuth1Session中面临这个问题。我已经安装了tweepy。我还安装了requests_oauthlib,但仍然无法解决此错误 from tweepy.auth import OAuthHandler #error called here (**ImportError: cannot import name 'OAuth1Session' from 'request

我是django框架的新手。我尝试使用tweepy通过twitter创建登录身份验证。在将提取的数据保存到数据库中时,我在OAuth1Session中面临这个问题。我已经安装了tweepy。我还安装了requests_oauthlib,但仍然无法解决此错误

from tweepy.auth import OAuthHandler  #error called here (**ImportError: cannot import name 'OAuth1Session' from 'requests_oauthlib'** )
from .models import Tweet
import credentials

def user_tweets():
    auth = OAuthHandler(credentials.CONSUMER_KEY, credentials.CONSUMER_SECRET)
    auth.set_access_token(credentials.ACCESS_TOKEN, credentials.ACCESS_TOKEN_SECRET)
    api = tweepy.API(auth)
    user_tweets = api.user_timeline(count=50)
    return user_tweets

确保您也安装了
请求
。例如,您可以这样做:

$ pip install requests requests_oauthlib


谢谢你的回答,但是我已经试过了,但是仍然不起作用
$ pip3 install requests requests_oauthlib