Python3无法识别sqli

2024-04-26 06:50:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我在linux上安装了python3。在python解释器中,我尝试了

import sqlite3

得到了

^{pr2}$

所以我安装了sqlite

sudo apt-get install libsqlite-dev

然后根据自述文件中的说明重新编译python:

cd ~/Python-3.4.2;
./configure;
make;
make test;

在测试中有个错误

[ 97/389] test_sqlite
test_sqlite skipped -- No module named '_sqlite3'

当我完成安装并尝试运行相同的python代码时,我仍然得到相同的ImportError。我做错什么了?在

---编辑---

我试过了

pip install pysqlite

得到了这个错误,这似乎是Python2.7和Python3.4之间的问题:

Downloading/unpacking pysqlite
  Downloading pysqlite-2.6.3.tar.gz (76kB): 76kB downloaded
  Running setup.py (path:/tmp/pip_build_plat/pysqlite/setup.py) egg_info for package pysqlite
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_plat/pysqlite/setup.py", line 85
        print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."
                                                                           ^
    SyntaxError: Missing parentheses in call to 'print'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_plat/pysqlite/setup.py", line 85

    print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."

                                                                       ^

SyntaxError: Missing parentheses in call to 'print'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_plat/pysqlite
Storing debug log for failure in /home/plat/.pip/pip.log

Tags: installpipinpybuildsqlitesphinxsetup