• ImportError: No module named _sqlite3


    报错如下:

    >>> import rpy2.robjects
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/python27/lib/python2.7/site-packages/rpy2-2.8.5-py2.7-linux-x86_64.egg/rpy2/robjects/__init__.py", line 34, in <module>
        from rpy2.robjects.functions import Function, SignatureTranslatedFunction
      File "/usr/local/python27/lib/python2.7/site-packages/rpy2-2.8.5-py2.7-linux-x86_64.egg/rpy2/robjects/functions.py", line 5, in <module>
        from rpy2.robjects import help
      File "/usr/local/python27/lib/python2.7/site-packages/rpy2-2.8.5-py2.7-linux-x86_64.egg/rpy2/robjects/help.py", line 7, in <module>
        import sqlite3
      File "/usr/local/python27/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
        from dbapi2 import *
      File "/usr/local/python27/lib/python2.7/sqlite3/dbapi2.py", line 28, in <module>
        from _sqlite3 import *
    ImportError: No module named _sqlite3

     问题原因:

    在系统中同时存在多个不同版本的python。当前系统是由python 2.6.6升级到python 2.7.13而来。

    解决办法:

    [root@localhost sqlite-autoconf-3150000]# find / -name _sqlite3.so
    /usr/lib64/python2.6/lib-dynload/_sqlite3.so
    [root@localhost sqlite-autoconf-3150000]# whereis python
    python: /usr/bin/python /usr/bin/python2.6 /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /usr/share/man/man1/python.1.gz
    
    [root@localhost sqlite-autoconf-3150000]# find / -name lib-dynload
    /usr/lib64/python2.6/lib-dynload
    /usr/local/python27/lib/python2.7/lib-dynload
    
    [root@localhost sqlite-autoconf-3150000]# cp /usr/lib64/python2.6/lib-dynload/_sqlite3.so /usr/local/python27/lib/python2.7/lib-dynload
    [root@localhost sqlite-autoconf-3150000]# python
    Python 2.7.13 (default, Mar  9 2017, 04:32:58) 
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sqlite3
    >>> import rpy2.robjects
    >>> 
    >>> 
  • 相关阅读:
    第三周psp
    作业2
    词频统计 SPEC 20170914 1 1 1 1 1
    psp1111
    第一周大作业1
    mongodb安装操作 (2018/11/12)
    中间件 express生成项目(2018/11/10)
    express环境搭建(2018/11/09)
    后端路由(2018/11/07)
    Node模块的基本使用(2018/11/06)
  • 原文地址:https://www.cnblogs.com/RaymondBlog/p/6526469.html
Copyright © 2020-2023  润新知