zoukankan      html  css  js  c++  java
  • centos7 python3.5中引入sqlite3

    在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  

      >>> 

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

       
  • 相关阅读:
    vscode设置js文件自动格式化单引号
    解决git每次输入账号密码问题
    vscode设置vouter标签不换行
    查看修改npm地址并登录
    正则匹配[]外部的内容
    使用v-model实现父子组件之间传值
    发布网站
    安装IIS
    IIS服务添加角色
    react生命周期
  • 原文地址:https://www.cnblogs.com/zhming26/p/6159356.html
Copyright © 2011-2022 走看看