无法从Python搜索Google结果

时间:2020-07-07 07:45:24

标签: python compiler-errors google-search

我正在研究一个表明Google搜索结果的项目。一切正常,接受这段代码。

代码

from googlesearch.googlesearch import GoogleSearch
response = GoogleSearch().search("something")
for result in response.results:
    print("Title: " + result.title)
    print("Content: " + result.getText())

已解决错误

Traceback (most recent call last):
  File "d:/Programming/Python/Projects/Smart-Actions/gSearch.py", line 3, in <module>
    from googlesearch.googlesearch import GoogleSearch
  File "C:\Users\vinay\anaconda3\lib\site-packages\googlesearch\googlesearch.py", line 6, in <module>
    import urllib2
ModuleNotFoundError: No module named 'urllib2' 

我正在运行Python 3.7.6,请帮助我解决此错误。

0 个答案:

没有答案