Python 使用pyTrends时,会出现以下错误:TypeError:uu init_uu()缺少2个必需的位置参数:';谷歌用户名';和';谷歌密码&x27;

Python 使用pyTrends时,会出现以下错误:TypeError:uu init_uu()缺少2个必需的位置参数:';谷歌用户名';和';谷歌密码&x27;,python,Python,错误消息: TypeError Traceback (most recent call last) <ipython-input-2-3034775b0776> in <module> 6 # Create a Google Trend Object 7 ----> 8 totalTrend = TrendReq(hl='en-US', tz=360) 9

错误消息:

TypeError                                 Traceback (most recent call last)
<ipython-input-2-3034775b0776> in <module>
      6 # Create a Google Trend Object
      7 
----> 8 totalTrend = TrendReq(hl='en-US', tz=360)
      9 
     10 # Declare a var to store the search term

TypeError: __init__() missing 2 required positional arguments: 'google_username' and 'google_password'
TypeError回溯(最近一次调用)
在里面
6#创建谷歌趋势对象
7.
---->8总趋势=趋势需求(hl='en-US',tz=360)
9
10#声明一个var来存储搜索项
TypeError:\uuuuu init\uuuuuuuu()缺少2个必需的位置参数:“google\u用户名”和“google\u密码”

我不知道在哪里可以输入我的google用户名和google密码,以便正确访问gTrends。

从文档/示例中,您似乎需要先初始化连接并登录

# Login to Google. Only need to run this once, the rest of requests will use the same session.
pytrend = TrendReq()

# Get Google Hot Trends data

today_searches_df = pytrend.today_searches()
print(today_searches_df.head())

亲爱的克里斯,谢谢你。但我已经这样做了。我的问题是:在哪里,在哪个位置我可以输入我的谷歌密码和谷歌用户名登录谷歌?只需执行pytrend=TrendReq()就会出现上述错误。谢谢你,马里奥