我正在努力使Twitter搜索api一切正常但突然twittersearch()模块没有导入。我使用的是带有Windows 8.1 64位的python 3.4.2。我试过easy_install twittersearch它成功安装了包,一切都很好,但是当我运行这段代码时
from TwitterSearch import *
import pyodbc
cnxn = pyodbc.connect(driver='{SQL Server}', server='localhost', database='capstone',trusted_connection='yes')
cursor = cnxn.cursor()
cursor.execute("select word from dbo.search where sl in (select max(sl) from dbo.search)")
for row in cursor.fetchall():
print (row)
print("This is positive data ")
term = row[0]
try:
tso=TwitterSearchOrder()
tso.set_keywords([term])
tso.set_language('en')
当我执行此操作时,它会显示如下错误
Traceback (most recent call last):
File "C:\Python34\search_test.py", line 18, in <module>
tso=TwitterSearchOrder()
NameError: name 'TwitterSearchOrder' is not defined
但实际上我并不知道为什么它没有识别模块。直到2天后,它已成功运行IDLE但不在命令提示中,我重新安装了python并添加了所有工具,现在它在IDLE和命令提示符下都显示此错误 TIA