python 2.7.3对sqlite3模块的Centos的问题

时间:2021-10-08 18:26:10

i'm tying to play with sqlite3 on my centos server but it reports always the same error (module installed)....

我把我的centos服务器上玩sqlite3但它报告总是同样的错误(模块安装)....

Python 2.7.3 (default, Jun 29 2012, 19:03:18) 
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sqlite3/__init__.py", line 24, in <module>
    from dbapi2 import *
  File "sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: No module named _sqlite3

on ubuntu and so on works fine.... any ideas of what i'm missing here?

ubuntu等等没问题....你知道我错过了什么吗?


i recompile the 2.7.3 again and it catch the sqlite3 libs well.

我重新编译了2.7.3,它很好地捕获了sqlite3 libs。

4 个解决方案

#1


13  

If you are under RHEL/centos 6, you can try this:

如果你使用RHEL/centos 6,你可以尝试以下方法:

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

#2


6  

This will work for CentOS:

这将适用于CentOS:

ln -s /usr/lib64/python2.6/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/lib-dynload/

ln - s /usr/lib64/python2.6/lib-dynload / _sqlite3。所以/usr/local/lib/python2.7/lib-dynload /

/usr/local/lib/python2.7/ is already on python's path. No need to duplicate the file or add the python's path.

/usr/local/lib/python2.7/已经在python的路径上了。不需要复制文件或添加python的路径。

#3


2  

first find:

首先找到:

find / -name _sqlite3.so
/usr/usr/lib/python2.6/lib-dynload/_sqlite3.so
/usr/local/service/python2.7/lib/python2.7/lib-dynload/_sqlite3.so
/usr/lib64/python2.6/lib-dynload/_sqlite3.so

next

下一个

cp /usr/local/service/python2.7/lib/python2.7/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/sqlite3/

this centso 6.5 python2.7.10

这centso 6.5 python2.7.10

#4


0  

If you're using Python 2.7.3 on a Red Hat 5 or CentOS 5 machine, there was a bug that prevented the SQLite modules from compiling properly when building Python from source; you should see an error message when running make. It's since been fixed in 2.7.4 so your best option is to upgrade.

如果您在Red Hat 5或CentOS 5机器上使用Python 2.7.3,那么在从源代码构建Python时,有一个错误阻止了SQLite模块正确编译;运行make时应该会看到错误消息。它已经被修正在2.7.4,所以你最好的选择是升级。

If that's not possible, then there's a patch available. Here's the bug page and the patch.

如果这是不可能的,那么有一个补丁可用。这是错误页面和补丁。

#1


13  

If you are under RHEL/centos 6, you can try this:

如果你使用RHEL/centos 6,你可以尝试以下方法:

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

#2


6  

This will work for CentOS:

这将适用于CentOS:

ln -s /usr/lib64/python2.6/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/lib-dynload/

ln - s /usr/lib64/python2.6/lib-dynload / _sqlite3。所以/usr/local/lib/python2.7/lib-dynload /

/usr/local/lib/python2.7/ is already on python's path. No need to duplicate the file or add the python's path.

/usr/local/lib/python2.7/已经在python的路径上了。不需要复制文件或添加python的路径。

#3


2  

first find:

首先找到:

find / -name _sqlite3.so
/usr/usr/lib/python2.6/lib-dynload/_sqlite3.so
/usr/local/service/python2.7/lib/python2.7/lib-dynload/_sqlite3.so
/usr/lib64/python2.6/lib-dynload/_sqlite3.so

next

下一个

cp /usr/local/service/python2.7/lib/python2.7/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/sqlite3/

this centso 6.5 python2.7.10

这centso 6.5 python2.7.10

#4


0  

If you're using Python 2.7.3 on a Red Hat 5 or CentOS 5 machine, there was a bug that prevented the SQLite modules from compiling properly when building Python from source; you should see an error message when running make. It's since been fixed in 2.7.4 so your best option is to upgrade.

如果您在Red Hat 5或CentOS 5机器上使用Python 2.7.3,那么在从源代码构建Python时,有一个错误阻止了SQLite模块正确编译;运行make时应该会看到错误消息。它已经被修正在2.7.4,所以你最好的选择是升级。

If that's not possible, then there's a patch available. Here's the bug page and the patch.

如果这是不可能的,那么有一个补丁可用。这是错误页面和补丁。