【发布时间】:2023-08-26 10:39:01
【问题描述】:
一旦我尝试使用谷歌搜索 api,它就会向我显示一个错误:
Traceback (most recent call last):
File "C:\Users\Maor Ben Lulu\Desktop\Maor\Python\google\google_Bot.py", line 1, in <module>
from google import google
ModuleNotFoundError: No module named 'google'
我的代码:
from google import google
import urllib.request
import time
from bs4 import BeautifulSoup
def google_scrape(url):
thepage = urllib.request.urlopen(url)
soup = BeautifulSoup(thepage, "html.parser")
# print(soup.prettify())
return soup.prettify()
### Rest of the code
我做到了:
pip install google
但还是不行。
【问题讨论】:
-
我想建议您:如果您要使用谷歌数据,您必须使用他们的 API .. 我之前尝试了所有方法,但没有任何效果,或者它有效,但他们在很短的时间内阻止了您的 IP ,即使你使用这些非正式的包
-
你安装了两个python版本吗?并且您确定您使用管理 CMD 窗口进行了“pip install”吗?
-
运行
pip list会得到什么? -
你有几个版本的python? oyu 确定您在正确的版本上安装了 pip 吗?要检查你是否有 google 模块,你可以运行这个命令 help('modules') 来查看所有可用的模块。
标签: python google-api google-api-php-client google-search-api