ImportError: No module named _sqlite3 - 代码分享

时间:2021-04-14 00:04:49

ImportError: No module named _sqlite3 - 代码分享

ImportError: No module named _sqlite3
作者:86市场网       点击量 : 11926

今天在做防止暴力破解ssh,ftp时出现一下问题(python)

Traceback (most recent call last):
  File "main.py", line 9, in <module>
    from com.qsee.db.DbUtil import getAttackTuple, getRunStatus, runOver, alterAttackStatus,filter
  File "/root/scanAttack/com/qsee/db/DbUtil.py", line 7, in <module>
    import sqlite3, sys
  File "/usr/local/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
    from dbapi2 import *
  File "/usr/local/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *

ImportError: No module named _sqlite3

上面错误说明没有安装sqlite-devel,所以要先安装sqlite-devel,再编译升级python,才可以使用sqlite3库

1、先安装sqlite-devel:
 # yum install sqlite-devel -y

如果次shell不能运行

# vi /usr/bin/yum

把首行显示的 !#/usr/bin/python 修改为 !#/usr/bin/python2.4

2、之后下载编译安装python
这个我就不说了