0

pygoogle在 Python 上安装了用于 Google 搜索的模块。我从这里下载了模块包并成功运行 Pythonsetup.py安装:

navyad@ubuntu:~/Downloads/pygoogle-0.6$ sudo python setup.py install
running install
running build
running build_py
running install_lib
running install_egg_info
removing '/usr/local/lib/python2.7/dist-packages/pygoogle/pygoogle-0.6.egg-info' (and everything under it)
Writing /usr/local/lib/python2.7/dist-packages/pygoogle/pygoogle-0.6.egg-info
creating /usr/local/lib/python2.7/dist-packages/pygoogle.pth

但是在导入pygoogle模块时,我得到了一个ImportError

>>> from pygoogle import pygoogle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pygoogle

然后,我检查了安装文件夹/usr/local/lib/python2.7/dist-packages/pygoogle,发现没有__init__.py文件。

似乎正因为如此,它给了ImportError.

为什么__init__.py没有创建文件?

4

1 回答 1

0

显然模块名称是“google”。

尝试import google,如本例所示:

http://pygoogle.sourceforge.net/dist/readme.txt

于 2013-10-03T18:26:09.910 回答