ImportError: No mod

2023-01-31 03:01:38 importerror mod

报错如下错误:

>>> 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 xf python-2.17.10.tar.gz

cd python-2.17.10

python setup.py install

##################

tar xf setuptools-32.1.0.zip

cd setuptools-32.1.0

python setup.py install


####################

tar xf pip-9.0.1.tar.gz

cd pip-9.0.1

python setup.py install


相关文章