Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!novso.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.062 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'importerror:': 0.07; 'skip:/ 10': 0.09; 'subject:How': 0.10; 'python': 0.11; '2.7.3': 0.16; '23,': 0.16; 'debian.': 0.16; 'mkdir': 0.16; 'sqlite': 0.16; 'subject:import': 0.16; 'subject:sqlite3': 0.16; 'sudo': 0.16; 'url:ftp': 0.16; 'module': 0.19; '>>>': 0.22; 'import': 0.22; 'install': 0.23; 'header:User-Agent:1': 0.23; '>>>': 0.24; 'skip:l 30': 0.24; 'compiled': 0.26; 'installed': 0.27; '"",': 0.31; 'python2.7': 0.31; 'file': 0.32; 'linux': 0.33; 'url:python': 0.33; '(most': 0.33; 'skip:_ 10': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'skip:" 50': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'skip:- 20': 0.37; 'two': 0.37; 'message-id:@gmail.com': 0.38; 'skip:& 10': 0.38; 'nov': 0.38; 'version,': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'charset:gbk': 0.60; 'url:3': 0.61; 'skip:n 10': 0.64; 'more': 0.64; 'url:0': 0.67; 'mar': 0.68; '26,': 0.68; 'default': 0.69; 'url:4': 0.69; './configure': 0.84; '2014,': 0.84; 'apt-get': 0.84; 'skip:/ 30': 0.84; 'skip:| 10': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=9NbnroTZRJkvNgffIQHiIFNRvyb/dFlxzZEORuvPU+I=; b=itdamZJNnFhhyvV1xRTjYXHN8KupXeLBG0WzkeOBtNYYzK9cCmk2k6gZxz33LEdcc5 Cx441oPaxH3YMyIfYkKBryL8b53+tjsVS2UC0iG6/RJ6BHomvF4trXP3Q6ve0fBqhhH9 MXMM/iaL5JRPNpmH/5VyJJ6JsioOE01mSEpzZAZjx3+5Z6aXj9mHvX4N+QyykTSA3EG1 mRjUOlkFpMpT9JuxIXKqnECVYBYOExdDWk3D0kzfBMROdH6+ewk0bidtreZiprtrfnj6 o2xOeMS0sNOi87UQC8vKO/HN0gP+x3EwZ8UB9Adiyyc8M7mUrBVu1zLaq3+TruWWDOOS v2Hg== X-Received: by 10.66.231.200 with SMTP id ti8mr42534015pac.41.1418569610259; Sun, 14 Dec 2014 07:06:50 -0800 (PST) Date: Sun, 14 Dec 2014 23:06:11 +0800 From: sir User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: python-list@python.org Subject: How to import sqlite3 in my python3.4 successfully? Content-Type: multipart/alternative; boundary="------------070607090008040304080300" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 104 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418569618 news.xs4all.nl 2834 [2001:888:2000:d::a6]:36723 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82506 This is a multi-part message in MIME format. --------------070607090008040304080300 Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 7bit There are two python version in my debian7, one is python2.7 the system default version, the other is python3.4 which compiled to install this way. | apt-get update apt-get upgrade apt-get install build-essential wget http://www.python.org/ftp/python/3.4.0/Python-3.4.0.tgz tar-zxvfPython-3.4.0.tgz cdPython-3.4.0 mkdir/usr/local/python3.4 ./configure--prefix=/usr/local/python3.4 make make install ln-s/usr/local/python3.4/bin/python3.4 /usr/bin/python3.4 ln-s/usr/local/python3.4/bin/pip3.4 /usr/bin/pip3.4| I have installed sqlite this way on my debian. |sudo apt-get install sqlite3 libsqlite3-dev| In python2.7 |root@rebuild:~# python Python 2.7.3 (default, Mar 14 2014, 11:57:14) [GCC4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlite3| In python3.4 |root@rebuild:~# python3.4 Python 3.4.0 (default, Nov 27 2014, 13:54:17) [GCC4.7.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sqlite3 Traceback (most recent calllast): File "", line1, in File "/usr/local/python3.4/lib/python3.4/sqlite3/__init__.py", line23, in from sqlite3.dbapi2import * File "/usr/local/python3.4/lib/python3.4/sqlite3/dbapi2.py", line26, in from _sqlite3import * ImportError: No module named'_sqlite3'| How can i import sqlite3 in my python3.4 successfully? --------------070607090008040304080300 Content-Type: text/html; charset=gbk Content-Transfer-Encoding: 7bit

There are two python version in my debian7, one is python2.7 the system default version, the other is python3.4 which compiled to install this way.

 apt-get update
 apt-get upgrade
 apt-get install build-essential
 wget http://www.python.org/ftp/python/3.4.0/Python-3.4.0.tgz
 tar -zxvf Python-3.4.0.tgz
 cd Python-3.4.0
 mkdir /usr/local/python3.4
 ./configure --prefix=/usr/local/python3.4
 make
 make install
 ln -s /usr/local/python3.4/bin/python3.4   /usr/bin/python3.4
 ln -s /usr/local/python3.4/bin/pip3.4   /usr/bin/pip3.4

I have installed sqlite this way on my debian.

sudo apt-get install sqlite3 libsqlite3-dev 

In python2.7

root@rebuild:~# python
Python 2.7.3 (default, Mar 14 2014, 11:57:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3

In python3.4

root@rebuild:~# python3.4
Python 3.4.0 (default, Nov 27 2014, 13:54:17)
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/python3.4/lib/python3.4/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/python3.4/lib/python3.4/sqlite3/dbapi2.py", line 26, in <module>
    from _sqlite3 import *
ImportError: No module named '_sqlite3'

How can i import sqlite3 in my python3.4 successfully?

--------------070607090008040304080300--