免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4104 | 回复: 1
打印 上一主题 下一主题

急! solaris上python下无法import sqlite3。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-08-22 15:57 |只看该作者 |倒序浏览
事情大致是这样的,unix SPARC机器上,装了python2.7.1     

bash-3.00#  ./python
Python 2.7.1 (r271:86832, Aug 22 2011, 14:01:04)
[GCC 3.4.3 (csl-sol210-3_4-branch+sol_rpath)] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>>

用户要求安装一个名为ipython-0.11的程序,但是安装时,发现如下报错:
bash-3.00# python setup.py install
Traceback (most recent call last):
  File "setup.py", line 54, in <module>
    from IPython.utils.path import target_update
  File "/tmp/ipython-0.11/IPython/__init__.py", line 46, in <module>
    from .frontend.terminal.embed import embed
  File "/tmp/ipython-0.11/IPython/frontend/terminal/embed.py", line 32, in <module>
    from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
  File "/tmp/ipython-0.11/IPython/frontend/terminal/interactiveshell.py", line 26, in <m                  odule>
    from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC
  File "/tmp/ipython-0.11/IPython/core/interactiveshell.py", line 36, in <module>
    from IPython.core import history as ipcorehist
  File "/tmp/ipython-0.11/IPython/core/history.py", line 20, in <module>
    import sqlite3
  File "/usr/local/lib/python2.6/sqlite3/__init__.py", line 24, in <module>
    from dbapi2 import *
  File "/usr/local/lib/python2.6/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: No module named _sqlite3

经上网查看,怀疑python没有导入该sqlite3模块。但是官方信息都证实,python2.5之后软件本身都兼容了sqlite3。
我尝试进入python后,手动导入,出现如下报错:
bash-3.00#  ./python
Python 2.7.1 (r271:86832, Aug 22 2011, 14:01:04)
[GCC 3.4.3 (csl-sol210-3_4-branch+sol_rpath)] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/proj/application/tools/Python7.1_sol/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
    from dbapi2 import *
  File "/proj/application/tools/Python7.1_sol/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: No module named _sqlite3>>> ^D
bash-3.00#

server上以确认安装了sqlite
bash-3.00# cd /usr/local/sqlite/
bash-3.00# ls
bin      include  lib      share
bash-3.00#
bash-3.00# cd bin
bash-3.00# ls
sqlite3
bash-3.00# ls -l
total 224
-rwxr-xr-x   1 root     root      106020 Aug 19 12:16 sqlite3
bash-3.00#

求高手指点,问题出在哪里。

论坛徽章:
0
2 [报告]
发表于 2011-09-14 10:50 |只看该作者
唉, Python源代码安装时, 要在setup.py里指定sqlite的头文件的路径。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP