ImportError: No module named _sqlite3 暴力解决法
在服务器上安装scrapy,几年不玩这个框架,报ImportError: No module named _sqlite3,按网上重装来重装去的方法,未果。
另外有些资料甚至要重新源码编译python,想想太麻烦,又没做python虚拟环境。
有位仁兄提出一个暴力方法,可能不太优雅,但简单搞定之,
查找_sqlite3.so文件:
[root@localhost ~]# find / -name _sqlite3.so
/usr/lib/python2.6/lib-dynload/_sqlite3.so
查找python位置:
[root@localhost ~]# whereis python
python: /usr/bin/python /usr/bin/python2.6 /usr/bin/python2.6-config /usr/lib/python2.6 /usr/local/bin/python /usr/local/bin/python2.7 /usr/local/bin/python2.7-config /usr/local/lib/python2.7 /usr/include/python2.6 /usr/share/man/man1/python.1.gz
复制他娘的:
[root@localhost ~]# cp /usr/lib/python2.6/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/lib-dynload/