Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
837 views
in Technique[技术] by (71.8m points)

sqlite - How to upgrade sqlite3 in python 2.7.3 inside a virtualenv?

There is a sqlite3 library that comes with python 2.7.3, but it is hardly the latest version.

I would like to upgrade it within a virtualenv environment. In other words, the upgrade only applies to the version of python installed within this virtualenv.

What is the correct way to do so?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The below works for me, but please comment if there is any room for improvement:

  1. Activate the virtualenv to which you are going to install the latest sqlite3

  2. Get the latest source of pysqlite package from google code: wget http://pysqlite.googlecode.com/files/pysqlite-2.6.3.tar.gz

  3. Compile pysqlite from source and together with the latest sqlite database: python setup.py build_static

  4. Install it to the site-packages directory of the virtualenv: python setup.py install

  5. The above will actually install the pysqlite into path-to-virtualenv/lib/python2.7/site-packages, which is where all other pip-installed libraries are.

Now, I have the latest version of sqlite (compiled into pysqlite) installed within a virtualenv, so I can do: from pysqlite2 import dbapi2 as sqlite


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...