如何在virtualenv内升级python 2.7.3中的sqlite3? [英] How to upgrade sqlite3 in python 2.7.3 inside a virtualenv?

查看:39
本文介绍了如何在virtualenv内升级python 2.7.3中的sqlite3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

python 2.7.3 附带了一个 sqlite3 库,但它几乎不是最新版本.

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

我想在 virtualenv 环境中升级它.换句话说,升级只适用于安装在这个 virtualenv 中的 python 版本.

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?

推荐答案

以下对我有用,但如果有任何改进的空间,请评论:

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

  1. 激活要安装最新sqlite3

从谷歌代码获取pysqlite包的最新源:wget http://pysqlite.googlecode.com/files/pysqlite-2.6.3.tar.gz

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

从源代码编译pysqlite,并与最新 sqlite 数据库一起编译:python setup.py build_static

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

安装到virtualenv的site-packages目录:python setup.py install

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

以上实际上将pysqlite安装到path-to-virtualenv/lib/python2.7/site-packages,这是所有其他pip- 安装的库是.

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.

现在,我在 virtualenv 中安装了最新版本的 sqlite(编译成 pysqlite),所以我可以这样做:from pysqlite2 import dbapi2 as sqlite

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

这篇关于如何在virtualenv内升级python 2.7.3中的sqlite3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆