当前位置:   article > 正文

Python3 No module named ‘_sqlite3‘错误解决方案_python3 no module named sqlite3

python3 no module named sqlite3

运行python程序的时候,报错Python3 No module named '_sqlite3';

操作步骤:

安装成功后,继续重新安装python3

进入python3目录,修改setup.py

[root@localhost Python-3.7]# vi setup.py
查找" sqlite_inc_paths" 新增
'/usr/local/sqlite/include'
'/usr/local/sqlite/include/sqlite3'

接下来执行:

[root@localhost Python-3.7]# ./configure --enable-loadable-sqlite-extensions
[root@localhost Python-3.7]# make && sudo make install

[root@localhost Python-3.7]# find / -name _sqlite*.so

发现python3 多了
/root/Python-3.7/build/lib.linux-x86_64-3.6/_sqlite3.cpython-36m-x86_64-linux-gnu.so
/usr/local/lib/python3.7/lib-dynload/_sqlite3.cpython-36m-x86_64-linux-gnu.so
接下来我们在执行:
cp /usr/local/lib/python3.7/lib-dynload/_sqlite3.cpython-36m-x86_64-linux-gnu.so /usr/local/python3/lib/python3.7/lib-dynload/_sqlite3.so
再次进入python环境
执行命令import sqlite3已经可以正常了

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/711143
推荐阅读
相关标签
  

闽ICP备14008679号