我试图通过import
函数将sqlite
与python一起使用,但是看起来python找不到{
我的系统路径包含以下内容:
['', '/usr/local/share/python', '/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/distribute-0.6.26-py2.7.egg', '/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/pip-1.1-py2.7.egg', '/usr/local/Cellar/python/2.7.3/lib/python27.zip', '/usr/local/Cellar/python/2.7.3/lib/python2.7', '/usr/local/Cellar/python/2.7.3/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7.3/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.3/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.3/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.3/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.3/lib/python2.7/lib-dynload', '/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages', '/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info', '/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/IPython/extensions']
但是sqlite
列在usr/lib
中。在
编辑:
正如建议的那样,我尝试了import sqlite3
,但是python返回以下错误:
如何加载sqlite
?在
sqlite3是python模块的名称,该模块提供python和sqlite数据库引擎之间的接口。sqlite是基础数据库引擎的名称。在
所以(正如Martijn Pieters已经指出的)试着:
不需要向模块搜索路径添加任何内容;SQLite模块附带Python标准库。但是,您拼错了模块的名称,它被称为^{} (注意末尾的
3
):如果仍然出现错误,则说明您的自制程序安装已中断;您可能遇到了this bug。运行:
^{pr2}$修理。在
相关问题 更多 >
编程相关推荐