我在linux上安装了python3。在python解释器中,我试过
import sqlite3
得到了
ImportError: No module named '_sqlite3'
所以我用
安装了sqlitesudo apt-get install libsqlite-dev
然后根据README文件中的说明重新编译python:
cd ~/Python-3.4.2;
./configure;
make;
make test;
在测试过程中出现错误
[ 97/389] test_sqlite
test_sqlite skipped -- No module named '_sqlite3'
然后当我完成安装并尝试运行相同的python代码时,我仍然得到相同的ImportError。我做错了什么?
--- --- EDIT
我试过
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
答案 0 :(得分:-1)
安装libsqlite-dev后,你应该安装pysqlite
pip install pysqlite