Python EclipsePydev,在尝试导入sqlite3时,我得到;导入的未定义变量:connect";
Eclipse版本:版本:3.8.1Python EclipsePydev,在尝试导入sqlite3时,我得到;导入的未定义变量:connect";,python,eclipse,sqlite,pydev,Python,Eclipse,Sqlite,Pydev,Eclipse版本:版本:3.8.1 import sqlite3 sqlite3.connect('database.db') print "Database connected successfully" 在上面的代码中,sqlite3.connect()显示为 Undefined variable from import: connect 但是当我运行正确运行的代码时,为什么它在eclipse pydev中显示为错误?我也面临类似的问题,解决方案是--> 您需要在Window>Pref
import sqlite3
sqlite3.connect('database.db')
print "Database connected successfully"
在上面的代码中,sqlite3.connect()
显示为
Undefined variable from import: connect
但是当我运行正确运行的代码时,为什么它在eclipse pydev中显示为错误?我也面临类似的问题,解决方案是--> 您需要在Window>Preferences>PyDev>Python解释器的“强制内置”选项卡中添加“sqlite3”(不带引号) 查看此链接了解详细信息
您可以这样覆盖它:
sqlite3.connect('database.db')#@UndefinedVariable
。有关更多信息,请参阅。感谢cryptochronoconolite。我建议您通过阅读。