Eclipse 版本:版本:3.8.1
import sqlite3
sqlite3.connect('database.db')
print "Database connected successfully"
在上面的代码中,sqlite3.connect()显示为
Undefined variable from import: connect
但是当我运行代码时它运行正常,为什么它在 eclipse-pydev 中显示为错误?
请您参考如下方法:
我也遇到了类似的问题,解决方法是-->
您需要在 Window>Preferences>PyDev>Python Interpreter 的“forced builtins”选项卡中添加“sqlite3”(不带引号)
查看此链接了解详情 Python: Unresolved import error for sqlite3 in PyDev in Eclipse
