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 的“forcedbuiltins”选项卡中添加“sqlite3”(不带引号)
查看此链接了解详细信息 Python: Unresolved import error for sqlite3 in PyDev in Eclipse
关于python - Eclipse-pydev,在尝试导入 sqlite3 时出现 "Undefined variable from import: connect",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27372479/