问题
Eclipse version : Version: 3.8.1
import sqlite3
sqlite3.connect('database.db')
print "Database connected successfully"
in the above code, sqlite3.connect()
is displayed as
Undefined variable from import: connect
But when i run the code it is running properly, why is that it is displayed as Error in eclipse-pydev?
回答1:
I also faced the similar issue, solution is -->
You need to add 'sqlite3' (without the quotatios) in the 'forced builtins' tab in Window>Preferences>PyDev>Python Interpreter
check this link for details Python: Unresolved import error for sqlite3 in PyDev in Eclipse
来源:https://stackoverflow.com/questions/27372479/eclipse-pydev-while-trying-to-import-sqlite3-im-getting-undefined-variable-fro