解决“IMPORTERROR: NO MODULE NAMED _SQLITE3”问题
2015-10-31 20:05
489 查看
我们在安装一些基于python的程序时,经常遇到“ImportError: No module named _sqlite3”问题。
解决办法:需先编译sqlite3.
再来编译python2.7:
先修改Python-2.7.6目录里的setup.py 文件:
在下面这段的下一行添加’/usr/local/lib/sqlite3/include’,
然后
同时也解决了“ImportError: No module named time”问题。
编译完python后,会提示:
Python build finished, but the necessary bits to build these modules were not found:
_tkinter bsddb185 bz2
gdbm readline sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module’s name.解决办法也是修改Python-2.7.6目录里的setup.py 文件。
解决办法:需先编译sqlite3.
wget http://www.sqlite.org/sqlite-amalgamation-3.6.20.tar.gz tar zxvf sqlite-amalgamation-3.6.20.tar.gz cd sqlite-3.5.6 ./configure –prefix=/usr/local/lib/sqlite3 make make install (这样,sqlite3编译完成) rm /usr/bin/python /usr/local/bin/python
再来编译python2.7:
wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.bz2 tar jxvf Python-2.7.6.tar.bz2 cd Python-2.7.6
先修改Python-2.7.6目录里的setup.py 文件:
在下面这段的下一行添加’/usr/local/lib/sqlite3/include’,
sqlite_inc_paths = [ ‘/usr/include’, ‘/usr/include/sqlite’, ‘/usr/include/sqlite3′, ‘/usr/local/include’, ‘/usr/local/include/sqlite’, ‘/usr/local/include/sqlite3′, ‘/usr/local/lib/sqlite3/include’,
然后
./configure make make install (这样,python2.7编译完成) as3:~/Python-2.7.6# python -V Python 2.7.6 as3:~/Python-2.7.6# python Python 2.7.6 (default, Nov 20 2013, 07:15:04) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlite3 >>> (此处无“ImportError: No module named _sqlite3”的出错提示,表明导入sqlite3成功)
同时也解决了“ImportError: No module named time”问题。
编译完python后,会提示:
Python build finished, but the necessary bits to build these modules were not found:
_tkinter bsddb185 bz2
gdbm readline sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module’s name.解决办法也是修改Python-2.7.6目录里的setup.py 文件。
相关文章推荐
- [Database] 数据库B树
- [LeetCode] [SQL]: 182: Duplicate Emails
- SQL题
- Mysql在实际使用中的部署架构
- 数据库中的几个知识点
- 从Oracle中数据库中读取以Blob类型存储的图片显示在jsp页面中
- [转]SQL查询语句中的 limit offset
- [LeetCode] [SQL]: 181: Employees Earning More Than Their Managers
- Linux非法关机后重新开启MongoDB
- MySQL的体系结构概述
- 【MySQL】VS【SQLServer】
- PostgreSQL下迭代实现数据库递归查询
- 安装两次ORACLE客户端,PL-SQL登录报错 ORA-12154
- SQL处理非常见空串
- php 操作mongodb
- 存储过程与PL/SQL基本用法
- zendframwork2添加对mongodb的支持
- mysql explain 各列的含义
- PySqlite 学习笔记
- 创建数据库迁移