报错如下错误:
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>",line 1,in <module>
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: /usr/local/lib/python2.7/lib-dynload/_sqlite3.so: wrong ELF class: ELFCLASS32
>>> exit()
系统上已经安装了Python-2.7.4,由于要升级nltk模块,升级后出现上述错误,后来发现_sqlite3出现问题,百度、搜狗都找遍了,就是没找到解决办法,后来听一个哥们说直接yum安装sqlite和sqlite-devel,然后重新编译Python,正好手头上有Python-2.7.10,说动手就动手,开始干起来,具体流程如下:
下载python-2.17.10.tar.gz,pip-9.0.1.tar.gz,setuptools-32.1.0.zip 依次安装如下:
yum -y install sqlite selite-devel
tar xfpython-2.17.10.tar.gz
cdpython-2.17.10
python setup.py install
##################
tar xfsetuptools-32.1.0.zip
cdsetuptools-32.1.0
python setup.py install
####################
tar xfpip-9.0.1.tar.gz
cdpip-9.0.1
python setup.py install
原文链接:https://www.f2er.com/sqlite/198613.html