Eclipse-pydev, while trying to import sqlite3 im getting “Undefined variable from import: connect”

好久不见. 提交于 2019-12-11 02:03:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!