我在Python上安装了用于Google搜索的pygoogle
模块。
我从here下载了模块包并成功运行了Python setup.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
文件?
答案 0 :(得分:0)