在centos系统中创建Django app,报错如下:

django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'

解决方案:

  1. 安装sqlite-devel-3.3.6-2.x86_64.rpm:

    在centos仓库里有该软件包,通过yum直接安装即可:

    [root@localhost mysite]# yum install sqlite-devel

    已加载插件:fastestmirror, langpacks

    Loading mirror speeds from cached hostfile

    * base: mirrors.aliyun.com

    * extras: mirrors.yun-idc.com

    * updates: mirrors.btte.net

    软件包 sqlite-devel-3.7.17-4.el7.x86_64 已安装并且是最新版本

    无须任何处理

    由于我的已安装过,这里不再安装。

  2.  

    重新安装python3.3:

    [root@localhost Python-3.3.0]# ls

    build          config.sub    Grammar     libpython3.3m.a  Makefile.pre     Objects  pybuilddir.txt  Python         Tools

    config.guess   configure     Include     LICENSE          Makefile.pre.in  Parser   pyconfig.h      python-gdb.py

    config.log     configure.ac  install-sh  Mac              Misc             PC       pyconfig.h.in   README

    config.status  Doc           Lib         Makefile         Modules          PCbuild  python          setup.py

    当前目录为python3.3的安装目录:运行如下命令:

    ./configure --prefix=/usr/local/python

    make

    make install

  3. 3

    经过以上2步,重新导入sqlite3试试:

    [root@localhost mysite]# python3.3

    Python 3.3.0 (default, Oct 10 2014, 11:52:13)

    [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux

    Type "help", "copyright", "credits" or "license" for more information.

    >>> import sqlite3

    >>>

    没有报错,说明导入正常。

     

centos7 python3.5中引入sqlite3的更多相关文章

  1. centos7 Python3终端中敲击方向键显示「^[[C^[[D」

    [root@localhost src]# python3 Python ( , ::) [GCC (Red Hat -)] on linux Type "help", " ...

  2. python3.5中import sqlite3报错:ImportError: No module named _sqlite3

    原因:缺少相关库 解决方案: 1  安装相关库 yum install sqlite-devel 2  重新编译安装Python

  3. python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?

    python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...

  4. centos7 python3.5 下安装paramiko

    centos7 python3.5 下安装paramiko 安装开发包 yum install openssl openssl-devel python-dev -y 安装pip前需要前置安装setu ...

  5. 【译】深入理解python3.4中Asyncio库与Node.js的异步IO机制

    转载自http://xidui.github.io/2015/10/29/%E6%B7%B1%E5%85%A5%E7%90%86%E8%A7%A3python3-4-Asyncio%E5%BA%93% ...

  6. python3.7中asyncio的具体实现

    讲讲我在使用python异步IO语法时踩过的坑 简单介绍异步IO的原理 以及利用最新语法糖实现异步IO的步骤, 然后给出实现异步的不同例子 网上找了很多python的asyncio示例.很多都是用 # ...

  7. centos7+python3.6+nginx+uwsgi+django2的搭建笔记

    公司需上线一套python编写的代码,需要给搭建一套环境  ,本次采用centos7+python3.6+nginx+uwsgi2+django2+mysql5.7的方式来进行搭建 写在部署前 在线上 ...

  8. Java 终于在 Java 8 中引入了 Lambda 表达式。也称之为闭包或者匿名函数。

    本文首发于 blog.zhaochunqi.com 转载请注明 blog.zhaochunqi.com 根据JSR 335, Java 终于在 Java 8 中引入了 Lambda 表达式.也称之为闭 ...

  9. python接口自动化:python3.6中import Crypto.Hash报错的解决方案

    一:问题 python3.6中算法加密引入包Crypto报错,即便安装了: pip install crypto pip install pycrypto pip install pycryptodo ...

随机推荐

  1. Mac 添加ll命令

    执行 vim ~/.bash_profile 该文件有可能不存在,直接编辑即可. 在文件中加入: alias ll='ls -alF' 再执行 source ~/.bash_profile

  2. OpenH264编译ffmpeg android

    思科的 安装NASM git clone https://github.com/cisco/openh264.git Android Builds install android sdk and nd ...

  3. Materialize快速入门教程

    https://materializecss.com/ https://github.com/Dogfalo/materialize http://www.materializecss.cn/ 1,下 ...

  4. 你应该知道的CSS2.0中最常用的18条技巧

    一.使用css缩写 使用缩写可以帮助减少你CSS文件的大小,更加容易阅读.  具体内容请浏览:CSS常用缩写语法 二.明确定义单位,除非值为0. 忘记定义尺寸的单位是CSS新手普遍的错误.在HTML中 ...

  5. Ogre2.1 结合OpenGL3+高效渲染

    在DX10与OpenGL3+之前,二者都是固定管线与可编程管线的混合,其中对应Ogre1.x的版本,也是结合固定与可编程管线设计.转眼到了OpenGL3+与DX10后,固定管线都被移除了,相对应着色器 ...

  6. e858. 将键盘键和事件绑定

    This example creates a number of keystrokes and adds them to the input map of a component. When a ke ...

  7. C# 结构体 struct

    C# 结构体 struct C#中结构类型和类类型在语法上非常相似,他们都是一种数据结构,都可以包括数据成员和方法成员. 结构和类的区别: 1.结构是值类型,它在栈中分配空间:而类是引用类型,它在堆中 ...

  8. 每天一个linux命令:cd命令

    Linux cd 命令可以说是Linux中最基本的命令语句,其他的命令语句要进行操作,都是建立在使用 cd 命令上的. 所以,学习Linux 常用命令,首先就要学好 cd 命令的使用方法技巧. 1. ...

  9. Linux free命令使用及解析

    1. 命令格式 free [参数] 2. 命令功能 free 命令显示系统使用和空闲的内存情况,包括物理内存.交互区内存(swap)和内核缓冲区内存.共享内存将被忽略 3. 命令参数 -b 以Byte ...

  10. Thinkphp5笔记一:项目部署

    系统:window 7 64位 Thinkphp版本:5.0.5 环境:wampserver集成 笔记分为两大部分,配置篇与数据库篇 一.虚拟主机部署/本地部署 在网站根目录下建立文件index.ph ...