centos6 python 安装 sqlite 解决 No module named ‘_sqlite3′

原文连接:

http://blog.csdn.net/jaket5219999/article/details/53512071

系统red hat6.7 也即centos6.7 python3.5.2 安装 django 之后 创建project 以及 import sqlite3

都出现  No module named ‘_sqlite3′

>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/Python-3.5.0/python350/lib/python3.5/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/opt/python-3.5.0/python350/lib/python3.5/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *

解决:

1、yum -y install sqlite-devel

2、cd  Python-3.5.2       (python源码安装文件解压后的文件夹)

3、./configure --enable-loadable-sqlite-extensions --prefix=/opt/Python352     (--prefix可加可不加)

4、 make && make install

如果这几步还不行,就修改 Python-3.5.2文件夹里的setup.py文件以后,重复第三和第四步:

在 sqlite_inc_paths 中添加sqlite的include 路径
如:
        sqlite_inc_paths = [ ‘/usr/include‘,
                             ‘/usr/include/sqlite‘,
                             ‘/usr/include/sqlite3‘,
                             ‘/usr/local/include‘,
                             ‘/usr/local/include/sqlite‘,
                             ‘/usr/local/include/sqlite3‘,
                             ‘~/share/software/python/sqlite-3.6.20/include‘,     (~/share/software/python/sqlite-3.6.20是sqlite的安装路径)
                             ‘~/share/software/python/sqlite-3.6.20/include/sqlite3‘,
                           ]

二、如果是python2.7出现 import sqlite3 找不到 _sqlite模块的问题,就简单多了

1、# find / -name _sqlite*.so

/usr/lib64/python2.6/lib-dynload/_sqlite3.so

2、# whereis python2.7

python2: /usr/bin/python2.7 /usr/bin/python2 /usr/bin/python2.6 /usr/lib/python2.6 /usr/lib64/python2.6 /usr/local/bin/python2.7 /usr/local/bin/python2.7-config /usr/local/bin/python2 /usr/local/lib/python2.7 /usr/include/python2.6

3、cp /usr/lib64/python2.6/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/lib-dynload/_sqlite3.so

ok,搞定!

时间: 2024-10-16 15:27:26

centos6 python 安装 sqlite 解决 No module named ‘_sqlite3′的相关文章

python的工具pip进行安装时出现 No module named &#39;pip&#39;

现象: 解决: python -m ensurepip easy_install pip python -m pip install --upgrade pip #用于更新pip,默认安装的是pip9.0.1 问题:就是没有安装pip工具 python的工具pip进行安装时出现 No module named 'pip' 原文地址:https://www.cnblogs.com/igoodful/p/11479199.html

python manage.py startapp app 时候报错No module named _sqlite3

python manage.py startapp app 报错如下: File "manage.py", line 10, in <module>    execute_from_command_line(sys.argv)  File "/usr/local/python2.7/lib/python2.7/site-packages/Django-1.9.13-py2.7.egg/django/core/management/__init__.py"

centos7安装python3和Django后,ModuleNotFoundError: No module named &#39;_sqlite3&#39;

1.准备安装环境 yum groupinstall 'Development Tools' yum install zlib-devel bzip2-devel openssl-devel ncurses-devel 2.安装python3 去官网下载编译安装包或者直接执行以下命令下载 wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz 解压 tar -xvJf  Python-3.6.2.tar.xz 切换进入 cd

No module named _sqlite3 django python manage.py runserver

linux 执行django(python manage.py runserver),报错No module named _sqlite3,需要安装sqlite-devel,再重新编译安装python. 1.安装sqlite-devel yum install sqlite-devel 2.重新安装python tar -zxf Python-2.7.3.tgz cd Python-2.7.3 ./configure make && make install 然后就可以了.

windows下 python中报错ImportError: No module named &#39;requests&#39;

原因没有安装requests模块, 可以切换到python的安装目录找到 script文件夹 example: 进入cmd窗口切换到上面的目录直接运营下面两个命令中的一个 1. > Path\pip install requests 2. > Path\easy_install.exe requests 详细参考:https://stackoverflow.com/questions/17309288/importerror-no-module-named-requests ---------

python wordcloud 错误 ModuleNotFoundError: No module named &#39;query_integral_image&#39;

from query_integral_image import query_integral_image ModuleNotFoundError: No module named 'query_integral_image' 试过更新pip版本 github master源码安装 anaconda 安装 都不行!!!! 运行过程如果出现query_integral_image无法导入的错误,请把源码下的wordcloud目录删除掉.因为名字相同的话,它会优先查找本工程下是否有相同的类.但由于程

python异常之ModuleNotFoundError: No module named &#39;test01inner02&#39;

当我们使用sys.path.append(args) 指令向程序中导入模块时其实本次append操作只是在内存中完成的,如果要永久性的添加需要修改环境变量. 我们发现当我们使用print(sys.path)后返回的是一个列表,其中包含当前文件所在项目的路径,还有python的默认加载库,添加只是暂时的. 错误调用: 目录结构: A.test0102.py文件 # coding = utf-8 def sing(): print("happay new year") B.init.py文

解决no module named ipykernel_launcher

解决no module named ipykernel_launcher 最近开hydrogen的时候,提示no module named ipykernel_launcher. 记得以前解决过这个问题,就是kernel没配置或者配置好的kernel不认识了导致的,666了一些写法,发现很多人写的,要么是需要sudo的,要么是需要在conda里面用,跟我的情况都不一样,最后找到了一位老大的解决方案: python3 -m ipykernel install --user 执行完这一条命令之后,会

python3.4 &quot;ImportError: No module named &#39;_sqlite3&#39;&quot;

python3.4导入sqlite3是报错,如下: >>> import sqlite3 Traceback (most recent call last): File "<input>", line 1, in <module> import sqlite3 File "/usr/local/python3.4/lib/python3.4/sqlite3/__init__.py", line 23, in <modu