模块没有发现错误时,使用谷歌搜索API (SERPAPI)



当我在本地机器上运行这个示例代码时:

from serpapi import GoogleSearch
params = {
"api_key": "secret_api_key",
"engine": "google",
"q": "Coffee",
"location": "Austin, Texas, United States",
"google_domain": "google.com",
"gl": "us",
"hl": "en"
}
search = GoogleSearch(params)
results = search.get_dict()

我得到错误:

ModuleNotFoundError: No module named 'serpapi'

我在谷歌/必应搜索上找不到任何东西,也找不到关于如何安装这个模块或它甚至位于哪里的文档。它不响应pip安装。

使用可以使用下面的命令来解决上述问题

pip install google-search-results

你可以在GitHub链接

找到更多细节

我有同样的问题,甚至在安装谷歌搜索结果

问题:pycharm上选择的解释器在不同的虚拟环境中,没有安装Google-search

解决方案:在你的IDE中从安装了google-search-results的工作目录/virtual env中添加/选择解释器

最新更新